Support » Plugin: W3 Total Cache » [Plugin: W3 Total Cache] Redirect Loop – htaccess conflict?

  • I’m using the latest versions of WP and W3TC.

    I have rewrite rules in my .htaccess to make “” become “”.

    I’ve recently installed W3TC. The site is now working, but is still slow. I suspect the problem is this :

    is being rewritten as :

    The problem replicates for a few other cached .js files too. The website loads eventually, but it’s not fast.

    Has anyone come across this conflict before?
    Or could anyone suggest a solution, either on a more specific .htaccess rule to avoid trying to rewrite the “”, or maybe a way to rename the “” folder name within the plugin?

    Any help would be greatly appreciated!

Viewing 10 replies - 1 through 10 (of 10 total)
  • what .htaccess rule are you currently using?

    These are the ones I’m currently using :

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # to redirect to
    RewriteCond %{HTTP_HOST} ^tigercooke\.com$ [NC]
    RewriteRule ^(.*)$$1 [R,L]

    # to redirect to
    RewriteCond %{HTTP_HOST} ^tadhgcooke\.com$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www\.tadhgcooke\.com$ [NC]
    RewriteRule ^(.*)$$1 [R,L]

    There are also some rules left over from WP Super Cache which I don’t understand yet :

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule . /index.php [L]

    Your redirect of tigercooke to http://www.tigercooke is fine – it won’t do a redirect of xxx.tigercooke

    Its almost the same as the one I changed my redirect to to avoid problems with an additional redirect:

    RewriteCond %{HTTP_HOST} ^$ [NC]
    RewriteRule ^(.*)$$1 [L,R=301]

    Strictly speaking, yours is more correct, as the ‘.’ in mine rather than ‘\.’ in yours matches any character. I have R=301 rather than just R as I can never remember which redirect is the default (301 is ‘permanent’, I hope!)

    I don’t know what the extra rules you have are doing, sorry!

    Thanks efikim.

    I think my problem is related to this, rather than the domain rewrite :

    All I want to do is rewrite the domain, but I think when htaccess sees the / within the url it treats that in the same way as a domain, so I end up with appended to the entire url.

    I’ve experimented with a few rules using the ! operator and trying to get an IF/ELSE thing going, but I seem to be either generating server errors, creating loops or just not making any change whatsoever. Arg.

    The RewriteCond rule you have is very specific:

    firstly the %{HTTP_HOST} means just look at the domain name
    then the ^ means ‘starts with’ and the $ means ‘end of string’ and you’ve specified exactly every character in between.
    so it should only fire for a url beginning with the domain name (NC just means ignore case)
    (it shouldn’t look for any matches after the domain name – if it does, something else is broken!)

    Then the RewriteRule just says take everything that came after the domain name and stick it unchanged after the new domain name ‘’.

    This rule shouldn’t be looking beyond the domain name, so shouldn’t be the cause of what you’re seeing.

    PS – for short term testing to check this, you could just comment out that rule for a quick test.

    Hmmm. That’s a puzzler then.

    Is it possible that W3TC is causing the loop error then?

    I don’t know, sorry.
    needs input from Frederick I think!

    Okay… I’ve narrowed it down a little. When I look at the source code generated for the website, this code appears in the head :

    But there’s no such file in that location. There IS a “” file which contains just the number : 1368345474

    Then it’s rewritten as :

    There is a .htaccess file in the “min” folder with rewrite rules in it. Could that be a source of the problem?

    (There’s a similar error for the minified js file, but I figure if I sort the CSS problem out, it’ll fix the JS problem too.)

    By (lengthy) process of elimination it’s just the minify module that’s causing problems for me. I can’t seem to debug it. If anyone knows of a solution to this, please let me know. Thanks!

    Everything else seems to be working fine – although the far-future expires still isn’t setting correctly for some files.

    Plugin Author Frederick Townes


    The .htaccess file in the w3tc/min/ directory isn’t working on your server. Minify working has nothing to do with the response time from your server being high. If you paste the your entire .htaccess file here or better yet fill out a bug submission form from the support tab of the plugin.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘[Plugin: W3 Total Cache] Redirect Loop – htaccess conflict?’ is closed to new replies.