WordPress.org

Ready to get started?Download WordPress

Forums

WP Super Cache
[resolved] After upgrade, caching non-www homepage (10 posts)

  1. Biranit
    Member
    Posted 2 years ago #

    Hi,

    Another issue I've run into after the recent upgrade.

    Normally, if someone types in timesofisrael.com he is immediately redirected to http://www.timesofisrael.com

    But since the upgrade, he remains on timesofisrael.com - and gets an old cached homepage, that is not up-to-date with what shows on the www homepage.

    How can I fix this please?

    Thanks,

    Bira

    http://wordpress.org/extend/plugins/wp-super-cache/

  2. Marventus
    Member
    Posted 2 years ago #

    Hi.
    Whether I enter http://www.timesofisrael.com or http://timesofisrael.com I always land on http://www.timesofisrael.com, so it seems to be working expected/before?

  3. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    Redirects for me too. Perhaps someone had changed to the no-www briefly on the site and the front page had been cached?

  4. Biranit
    Member
    Posted 2 years ago #

    Marventus, Donncha:

    Try going to http://timesofisrael.com now and you will see what I mean.

    The way this works is:

    if there is NO timesofisrael.com folder in wp-content/cache/supercache, then it is indeed redirected as normal to http://www.timesofisrael.com

    However, if there is one, then the redirect stops working and the homepage version is the old one.

    I do not know how and under what conditions the www-less cached version gets created.

    I constantly delete the timesofisrael.com folder under wp-content/cache/supercache but right now I'm leaving it there so you can see it for yourself...

    Thanks,

    Bira

  5. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    I have seen this very occasionally but it shouldn't happen. A sure fire way of fixing it is by adding mod_rewrite rules to your .htaccess file that redirect the no-www to the www hostname.

    This looks like a good explanation of how to do it:
    http://www.thesitewizard.com/apache/redirect-domain-www-subdomain.shtml

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^timesofisrael\.com$ [NC]
    RewriteRule ^(.*)$ http://www.timesofisrael.com/$1 [R=301,L]
  6. Biranit
    Member
    Posted 2 years ago #

    Hi Donncha,

    Thanks for your quick reply.

    The .htaccess has this at the start:

    BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    #If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible

    If I alter it to this:

    BEGIN WPSuperCache
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^timesofisrael\.com$ [NC]
    RewriteRule ^(.*)$ http://www.timesofisrael.com/$1 [R=301,L]
    RewriteBase /
    #If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible

    Would it not be overwritten if/when super cache is upgraded or changed?

    Alternatively, is there anywhere else I should put those lines?

    Thanks a lot,

    Bira

  7. Donncha O Caoimh
    Member
    Plugin Author

    Posted 2 years ago #

    Put the extra lines above the "BEGIN WPSuperCache" line, and move the "RewriteEngone On" line up too.

  8. Biranit
    Member
    Posted 2 years ago #

    Excellent, that works. Thank you so much!

  9. Marventus
    Member
    Posted 2 years ago #

    Glad to hear that. You should check to see if the plugin did not add its own rule for that, and if it did, delete it so that it doesn't collide with the one provided by Donncha.
    Also, please don't forget to mark this thread as resolved whenever you can.
    Thanks!

  10. Biranit
    Member
    Posted 2 years ago #

    Done, thanks :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic