WordPress.org

Support

Support » Plugins and Hacks » Wp Super Cache serve non-cache to specific User Agent?

Wp Super Cache serve non-cache to specific User Agent?

  • Stefan
    Member

    @stefan1st

    I’m using Wp Super Cache which is a very important plugin for my site, basically I can’t run my website without it and not with other cache plugin. What I want to do is somehow serve non-cached to Googlebot using .htaccess with something like rewritecond user agent !googlebot, but I don’t know how to do this. I already search the internet, couldn’t find anything that helps on my level. Does anyone know how to do this?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Stefan
    Member

    @stefan1st

    P.S. I’m opened to ideas if there’s another way than htaccess

    Stefan
    Member

    @stefan1st

    I tried to add Googlebot as mobile, but how I tried it didn’t work. This could be an option.

    Stefan
    Member

    @stefan1st

    This is what I’ve tried so far and didn’t work, don’t know why because it seems right:

    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    # ADDED THIS LINE TO PASS-THROUGH USER AGENTS
    RewriteCond %{HTTP_USER_AGENT} !(Googlebot|Google|Adsense)
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz [L]
    
    RewriteCond %{REQUEST_URI} !^.*[^/]$
    RewriteCond %{REQUEST_URI} !^.*//.*$
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} !.*=.*
    RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
    # ADDED THIS LINE TO PASS-THROUGH USER AGENTS
    RewriteCond %{HTTP_USER_AGENT} !(Googlebot|Google|Adsense)
    RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
    RewriteRule ^(.*) /wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html [L]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Wp Super Cache serve non-cache to specific User Agent?’ is closed to new replies.