Title: .htaccess HTTP_COOKIE not working (Super Cache problem)
Last modified: August 19, 2016

---

# .htaccess HTTP_COOKIE not working (Super Cache problem)

 *  ResolvedModerator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [18 years, 4 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/)
 * WP Super Cache is working fine with one little problem for me. The “RewriteCond%{
   HTTP_COOKIE} !^.*wordpressuser.*$” portion does not seem to be engaging.
 * When I log into my blog and try to reply to a comment, I do not get the usual“
   Logged in as…” message. Instead I get the static HTML page out of the cache and
   I end up removing that page out of the cache to reply as myself.
 * Which is odd, my wordpressuser_XXXXXXXXXXX cookie is set and the rewrite condition
   should prevent me from hitting the static version out of /wp-content/cache/supercache/.
 * I’m betting that there is something basic I’m missing, any help would be appreciated.
   Aside from HTTP_COOKIE not working, my re-write works fine for my permalinks.
 * Here is a copy of my .htaccess for reference:
 *     ```
       # BEGIN WordPress
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteCond %{QUERY_STRING} !.*s=.*
       RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
       RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
       RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
       RewriteCond %{HTTP:Accept-Encoding} gzip
       RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz -f
       RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html.gz [L]
   
       RewriteCond %{QUERY_STRING} !.*s=.*
       RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
       RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
       RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
       RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/$1index.html -f
       RewriteRule ^(.*) /wp-content/cache/supercache/%{HTTP_HOST}/$1index.html [L]
       <IfModule mod_rewrite.c>
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
       </IfModule>
   
       </IfModule>
       # END WordPress
       ```
   
 * Nested IfModule put in by plugin.
 * Thanks,
 * Jan Dembowski

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [18 years, 4 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673610)
 * Gah. I think I found what the problem was. I’m using [Admin SSL](http://haris.tv/2007/04/24/admin-ssl-new-wordpress-plugin/)
   so the cookie that is set for the SSL version of the page.
 * Disabling that plugin, clearing my browser cache and cookies seems to fix it.
   With the cookie set that way then the test works in .htaccess. I’ll check but
   I think that just commenting will always work (vs logging in).
 * I’ll play with the re-write rules (I’m also trying to see if I can get the re-
   write rules working for this and Lighttpd) and see if I can get it working.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [18 years, 3 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673698)
 * If you are using the Admin SSL plugin and WP Super Cache then add to your .htaccess
   this line in the WP Super Cache section:
 *     ```
       RewriteCond %{HTTP_COOKIE} !^.*wordpressloggedin_.*$
       ```
   
 * Then when you login using SSL the .htaccess will not serve the static page.
 *  [Trent Adams](https://wordpress.org/support/users/trent/)
 * (@trent)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673713)
 * I am having this issue as well and that additional line in the .htaccess didn’t
   seem to help. Any ideas?
 * Trent
 *  [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673714)
 * Trent – any unusual cookies? Any plugins we should know about?
 *  [Trent Adams](https://wordpress.org/support/users/trent/)
 * (@trent)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673715)
 * Nothing unusual donncha. I am running the [Haris.tv ssl admin plugin](http://haris.tv/2007/04/24/admin-ssl-new-wordpress-plugin/)
   the same as Jan and trying to get it to play nice with the wp-super-cache plugin
   you wrote. The cache plugin checks to see if the user has commented or is logged
   in looking for the normal wordpress cookie and the ssl admin plugin encrypts 
   the cookie so it is more secure. Just trying to find a way to get your cache 
   plugin to notice the new cookie.
 * Just for reference, I tried Ryan’s plugin, but it didn’t work for me as it gave
   me an indefinite loops trying to find the admin area.
 * Being more specific, if I turn off super cache and just leave on wp-cache, it
   works fine. The minute I turn on super cache again it doesn’t notice the cookie.
   Instead, it serves up the super cache page and not the wp-cache page (if super
   exists) and doesn’t read the cookie unless I hit the https same version of the
   page.
 * It really is perplexing and the line Jan references doesn’t seem to work for 
   me, but maybe it is about location in the .htaccess? I have other plugins running,
   but nothing that plays around with the cookies at all. Super Cache works fine
   before enabling this plugin as well.
 * Thanks,
 * Trent
 *  [Donncha O Caoimh (a11n)](https://wordpress.org/support/users/donncha/)
 * (@donncha)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673716)
 * Is the cookie key that plugin generates predicatable? Can you hard code it or
   a portion of it into the .htaccess rule?
    That RewriteCond should be repeated
   twice if you’re using .gz compression, or once otherwise. It should appear just
   before the RewriteRule line(s) in .htaccess that serve the super cache files.
 * If I had time I’d debug that plugin myself but unfortunately time is something
   I don’t have.
 *  [Trent Adams](https://wordpress.org/support/users/trent/)
 * (@trent)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673717)
 * yeah donncha you are a bit busy these days 🙂 Appreciate the comments. I *think*
   I have it working now with the following:
 *     ```
       RewriteCond %{HTTP_COOKIE} !^.*comment_author_.*$
       RewriteCond %{HTTP_COOKIE} !^.*wordpressuser.*$
       RewriteCond %{HTTP_COOKIE} !^.*wp-postpass_.*$
       ```
   
 * The difference being that I used the wordpressuser without the “_” at the end.
   It seems to be working now.
 * Thanks for you time and your help!
 * Cheers,
 * Trent
 *  [askapache](https://wordpress.org/support/users/askapache/)
 * (@askapache)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673727)
 * This works even better.
 * `RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$`

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘.htaccess HTTP_COOKIE not working (Super Cache problem)’ is closed to
new replies.

 * 8 replies
 * 4 participants
 * Last reply from: [askapache](https://wordpress.org/support/users/askapache/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/htaccess-http_cookie-not-working-super-cache-problem/#post-673727)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
