• I think it would be great to prevent Google or anyone from viewing cache files directly when using the advanced Apache/Nginx configuration. Those files should have canonical meta tags, but are still weird to be able to view directly.

    Something simple like this could be included with the recommended snippet.

    
    RewriteCond %{THE_REQUEST} /wp-content/cache/cache-enabler/ [NC]
    RewriteRule ^ - [F]
    

    or if you’d rather it 404

    
    RewriteCond %{THE_REQUEST} /wp-content/cache/cache-enabler/ [NC]
    RewriteCond %{ENV:REDIRECT_STATUS} !=404
    RewriteRule ^ - [R=404]
    
Viewing 1 replies (of 1 total)
  • Thread Starter Corey Worrell

    (@coreyw)

    Another possible solution

    
    RewriteCond %{REQUEST_URI} ^/wp-content/cache/cache-enabler/ [NC]
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^ - [F]
    

    or 404

    
    RewriteCond %{REQUEST_URI} ^/wp-content/cache/cache-enabler/ [NC]
    RewriteCond %{ENV:REDIRECT_STATUS} ^$
    RewriteRule ^ - [R=404]
    
Viewing 1 replies (of 1 total)
  • The topic ‘Prevent direct access to cache files’ is closed to new replies.