• EDIT: nevermind, after including “googlebot” in the forum search query I found some answers. Duh. ??

    Hello,

    I’m using the “Redirection” plugin to help me catch some 404 errors and fix them (if necessary). After I began using Autoptimize, I see that GoogleBot tries to access a lot of (apparently gone/expired) Autoptimize cache files.

    I figure that excluding the /cache/ directory via robots.txt is probably not a good idea, so I’m wondering if that is normal, expected behaviour, or did I screw something up?

    Thanks for the help
    Alexander.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Well, new info; try below code snippet;

    add_filter( 'autoptimize_filter_cache_do_fallback', '__return_true' );
    add_filter('template_redirect', 'ao_404_fixer' );
    function ao_404_fixer() {
    	global $wp_query;
    	$original_request = strtok( $_SERVER['REQUEST_URI'], '?' );
    	if ( strpos ( $original_request, AUTOPTIMIZE_CACHE_CHILD_DIR ) !== false && is_404() ) {
    		$wp_query->is_404=false;
    		$fallback_target  = preg_replace( '/(.*)_(?:[a-z0-9]{32})\.(js|css)$/', '${1}_fallback.${2}', $original_request );
    		wp_redirect( $fallback_target, 302);
    	}
    }

    this first filter activates “hidden” logic in AO to create fallback-files, the 2nd builds on that and will probably be added in 2.7 …

    Thread Starter Alexander S. Kunz

    (@antermoia)

    Oh, excellent. Thank you!

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    you’re welcome, keep me posted on how this works out for you if you try this ??

    Thread Starter Alexander S. Kunz

    (@antermoia)

    I just got home and added the code snippet. I’ll take a look at the 404 logs tomorrow, by that time I should see something. Or not. ??

    Thread Starter Alexander S. Kunz

    (@antermoia)

    Hi there!

    After adding the code snippet Friday night, there are no more entries from bots trying to find expired Autoptimize cache files in my logs.

    Thanks a lot for the help!
    Alexander.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    great! I just added this logic to AO 2.7 beta, so once 2.7 comes out, you can delete the snippet (all but the first line) ??

    Hi there. I’m facing the issue of 404 of cached css files. My page is not looking for non-cached css files. On reloading everything works fine. Please help me what to do.

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    As per the forum guidelines can you create a new topic for your problems @kartikeym1212 ?

    thank you,
    frank

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘GoogleBot tries to access gone cache files’ is closed to new replies.