WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: W3 Total Cache] redirect error (14 posts)

  1. madsurfer
    Member
    Posted 3 years ago #

    Hi,

    I decided to switch from wp-super-cache to w3-total-cache due to all the great stories. But I am running into some problems with the redirects and I am hoping someone can help me with that.

    My site consists of multiple wordpress installs. The .com is a regular install. And i run another wordpress install to show the dutch content on .com/nl (.nl redirects also to .com/nl).

    After enabling w3 total cache the redirects are not function like they should.

    http://www.madwindsurfing.com is redirected properly to http://madwindsurfing.com. (first install wordpress)

    http://www.madwindsurfing.nl and http://madwindsurfing.nl is redirect to http://madwindsurfing.com/nl/wp-content/w3tc/pgcache/_index.html.gzip instead of http://madwindsurfing.com/nl (where the second wp install resides). This page will give an 404 error. The weird thing is that not all browsers do this. IE7 and mozilla are working correctly on win7 and chrome is not.

    How can i fix this?

    ----------------------------- htaccess .com ------------
    [Code moderated as per the Forum Rules. Please use the pastebin]

  2. madsurfer
    Member
    Posted 3 years ago #

    Here is the htaccess for the .com (first wordpress install)
    http://wordpress.pastebin.com/k5PGns3x

    Here is the htaccess for the .nl (second wordpress install)
    http://wordpress.pastebin.com/UmSjZrjV

  3. Frederick Townes
    Member
    Posted 3 years ago #

    I believe I replied to your support submission, make sure your redirect rules are at the top of your .htaccess file.

  4. Rutger Groot
    Member
    Posted 3 years ago #

    Make sure your redirect rules are at the top of your .htaccess file

    This fixed my issue. Many thanks!

  5. Frederick Townes
    Member
    Posted 3 years ago #

    Ok cool.

  6. joefletcher
    Member
    Posted 3 years ago #

    Thanks! That fixed it for me, too. Was struggling forever on this.

  7. Frederick Townes
    Member
    Posted 3 years ago #

    Glad to hear it.

  8. DanMichel
    Member
    Posted 3 years ago #

    How can we make sure the redirect rules are on the top when whenever we make a change to W3 total access it automatically put it's rewrites on the top? is there some php code we can use to tell it to put it on the bottom?

  9. lrastart
    Member
    Posted 3 years ago #

    I have the same problem as Dan.

  10. bkoplin2
    Member
    Posted 3 years ago #

    Hi,

    i did exactly as You said and put usual WordPress htaccess rules at the top so my top looks like:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress

    and after that is all the rest of w3 total cache plugin htaccess rules. But it doesn't resolve my problem. Stil have problems with www to non-www redirect. My website is http://symbolika.net (instaled as http://www.symbolika.net ) and should be normalny with www but it doesn't work properly.

    Another website is http://przyslowia-cytaty.com ( should be http://www.przyslowia-cytaty.com ).

    I checked it in Opera, FireFox, Internet Explorer nad 2 sites to redirection check and it doesn't work :/

    What do I need to do with that? Please help.

  11. lrastart
    Member
    Posted 3 years ago #

    You need to have a redirect, first of all. With what you have there, there isn't a redirect. Here is the generic rule you need... put this in the WordPress htaccess rule:

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

    If you need https (I haven't tried this one):

    RewriteCond %{HTTPS} off
      RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
      RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
    
      RewriteCond %{HTTPS} on
      RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
      RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

    The problem is when you change a setting in W3TC, it diverts the WordPress rules back under the W3TC rules.

  12. bkoplin2
    Member
    Posted 3 years ago #

    damn, i thought that the default wordpress rule will work out but in some other configuration.

    I spent all day to change it and try try and try... and it's all for nothing.

    Irastart You're right! Thanks a lot for help : ) it works now.

  13. lrastart
    Member
    Posted 3 years ago #

    No problem. I use elegant themes too... their themes are great:

  14. Frederick Townes
    Member
    Posted 3 years ago #

    The next release handles rules modifications better.

Topic Closed

This topic has been closed to new replies.

About this Topic