Title: Super Cache rewrite rules causing endless loop ?
Last modified: August 19, 2016

---

# Super Cache rewrite rules causing endless loop ?

 *  [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [18 years, 2 months ago](https://wordpress.org/support/topic/super-cache-rewrite-rules-causing-endless-loop/)
 * Hi Donncha et al. ,
 * Trying your excellent plugin (which does work fine so it seems) I noticed errors
   in the server errorlogfile like this one:
 * > [Fri Mar 14 15:33:08 2008] [error] [client 82.99.30.28] mod_rewrite: maximum
   > number of internal redirects reached. Assuming configuration error. Use ‘RewriteOptions
   > MaxRedirects’ to increase the limit if neccessary.
 * I am on a shared host and have no clue why, when or how these errors are caused.
   So I asked the server admin what could be causing these. He replied that it was
   probably caused by rewrite rules beginning with / and pointed me at [http://www.sitepoint.com/print/mod_rewrite-no-endless-loops](http://www.sitepoint.com/print/mod_rewrite-no-endless-loops)
   for more info.
 * Now the date on that page is rather old, so it might not be valid anymore… Or
   does the server admin have a point here? Should the rules maybe be (notice the
   missing / at the two end rules):
 *     ```
       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}/$1/index.html.gz -f
       RewriteRule ^(.*) wp-content/cache/supercache/%{HTTP_HOST}/$1/index.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}/$1/index.html -f
       RewriteRule ^(.*) wp-content/cache/supercache/%{HTTP_HOST}/$1/index.html [L]
       ```
   
 * I have tested this on my WP_MU 1.3.3 and it seems to work fine… I have taken 
   no long time to wait for new error lines in the logfile but at least the caching
   works.
 * The WP_MU installation is in the httpdocs (root) so I have `RewriteBase /` in
   my .htaccess. No idea how these changes (if at all relevant) would impact installations
   in a subdir (I saw a thread about RewriteBase issues that may be related/affected?)…
 * Can you, or anyone else, advise me on this matter?
 * Thanks 🙂

Viewing 1 replies (of 1 total)

 *  [askapache](https://wordpress.org/support/users/askapache/)
 * (@askapache)
 * [18 years, 1 month ago](https://wordpress.org/support/topic/super-cache-rewrite-rules-causing-endless-loop/#post-713044)
 * This works for me,
 *     ```
       # BEGIN WordPress
   
       RewriteCond %{QUERY_STRING} !s
       RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
       RewriteCond %{HTTP:Accept-Encoding} gzip
       RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+)(/?)\ HTTP/ [NC]
       RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/%2/index.html.gz -f
       RewriteRule ^(.+)$ /wp-content/cache/supercache/%{HTTP_HOST}/%2/index.html.gz [L]
   
       RewriteCond %{QUERY_STRING} !s
       RewriteCond %{HTTP_COOKIE} !^.*(comment_author_|wordpress|wp-postpass_).*$
       RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(.+)(/?)\ HTTP/ [NC]
       RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{HTTP_HOST}/%2/index.html -f
       RewriteRule ^(.+)$ /wp-content/cache/supercache/%{HTTP_HOST}/%2/index.html [L]
   
       RewriteCond %{REQUEST_FILENAME} !-f
       RewriteCond %{REQUEST_FILENAME} !-d
       RewriteRule . /index.php [L]
   
       # END WordPress
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Super Cache rewrite rules causing endless loop ?’ is closed to new replies.

## Tags

 * [mod_rewrite](https://wordpress.org/support/topic-tag/mod_rewrite/)

 * 1 reply
 * 2 participants
 * Last reply from: [askapache](https://wordpress.org/support/users/askapache/)
 * Last activity: [18 years, 1 month ago](https://wordpress.org/support/topic/super-cache-rewrite-rules-causing-endless-loop/#post-713044)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
