• Resolved Rafael

    (@jordh)


    Hello,

    Yesterday, my site suddenly stopped working, only generating 500 errors. My hoster told me that his logs show an error in the .htaccess file of my WordPress installation:

    .htaccess: RewriteBase: argument is not a valid URL

    I restored the .htaccess file from a backup I did a month ago and the site is now working again.

    I compared the defect .htaccess with the current one and found that the single difference was this piece of code:

    # BEGIN W3TC Page Cache core
    <IfModule mod_rewrite.c>
    ...
        RewriteBase ?lang=en
    ...
    </IfModule>
    # END W3TC Page Cache core

    instead of the working

    # BEGIN W3TC Page Cache core
    <IfModule mod_rewrite.c>
    ...
        RewriteBase /
    ...
    </IfModule>
    # END W3TC Page Cache core

    I run a multilingual site through WPML, but I have not touched the redirect structure for different languages in over a year. The plugins were last updated several days ago; the only thing that I did when the .htaccess file was changed has been emptying the W3TC cache.

    Why did W3TC change the .htaccess file in a way that made the whole installation inaccessible?

    Regards,
    Rafael

    • This topic was modified 6 years, 2 months ago by Rafael.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @jordh,

    Depending on the settings and changes you make and save them, w3tc writes the rules in .htaccess.
    On wpml website, there is a guide on how to set up WPML with W3 Total Cache which you can find here.
    Please make sure to follow these steps in order to properly configure the W3 Total Cache

    Thread Starter Rafael

    (@jordh)

    Hello @vmarko,

    thank you for your response.

    I have double-checked my settings and I had nothing activated that wasn’t specified in that guide.

    I also did not change any W3TC or WPML settings in the past months. The last time something had changed was when I updates WPML to its current version two weeks ago.

    Regards,
    Rafael

    Thread Starter Rafael

    (@jordh)

    Hello @vmarko,

    I did some testing on an internal copy of the site.

    As it turns out, W3C makes the site-breaking edit to the .htaccess file any time I hit the “Purge All Caches” button in the admin bar of a translated page (and thus access an URL with the parameter “&lang=en&w3tc_flush_all”) resulting in “500” errors for all pages until I manually restore the .htaccess file to its prior state.

    Regards,
    Rafael

    • This reply was modified 6 years, 1 month ago by Rafael.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @jordh,

    I think there’s an issue when purging from a translated page. To prevent this issue you can just not click purge caches from the translated page. Purge cache on the main domain will also purge other languages if they’re not using multisite.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘W3TC edit to my .htaccess broke the site’ is closed to new replies.