Plugin breaks .htaccess 301 redirects: my suggestion for how to resolve
-
I actually solved this problem by myself, but I have to let you folks know that this is causing issues, and should be fixed.
I didn’t even know this was happening for months until someone recently reported a broken link on my website, because my dozens of 301 redirects weren’t working at all.
I had a .htaccess file full of custom rules before I installed W3TC. Apparently, the plugin inserted its own rules and deleted all of mine. Completely. There was not one custom rule left in my file. (I can’t remember which version was this, but it was a while ago.)
The plugin did not warn me it would alter my .htaccess file, or suggested I back it up. I had no way of knowing it has done that. I had no reason to check the file.
Thankfully I had an old local backup that I was able to copy my rules from today, and only when I copied them before BEGIN W3TC Browser Cache did my redirects start working again. So my suggestions for improvement:
- Warn users that the plugin will alter their .htaccess file and offer to back up the contents.
- When adding W3TC rules, add them after everything that’s already in there, not before. Because any 301 redirects have to come before W3TC rules in order to work. Once W3TC messes with the URL structure, they will no longer match with the URL redirect rules, and the result is a 404 error.
If there’s a better place to send this suggestion let me know, but I hope you can forward this to your dev team.
- The topic ‘Plugin breaks .htaccess 301 redirects: my suggestion for how to resolve’ is closed to new replies.