Category Archives: About Work

Be careful about changing the .htaccess if you manage your website with WordPress

I had a customized .htaccess for my website so that all the old links could be 301-redirected to the new links once the website was fully ported to WordPress, and things worked great. I uploaded all the content, the .htaccess file, activated my theme, and changed the permalink structure to make the URLs SEO-friendly.

After a few days I was checking Google analytics, and noticed that some links that didn’t exist in the main navigation, but existed on the inner pages, were not being found, and needed to be redirected. I quickly added them to my .htaccess file and re-uploaded the file. After a few hours I noticed none of my pages worked. I remember this happening once, so I went to the permalinks section in the WordPress admin and again saved the permalinks setting. The links started working again.

Then today again I uploaded the .htaccess file and noticed that the website stopped working. Again I went to the permalinks section, saved the permalinks setting and the pages came back. Then it came to my mind that whenever you make changes to the permalinks structure, WordPress changes your .htaccess file. So whenever I was uploading my version of .htaccess, the changes were being overwritten, and the pages refused to work. Dumb of me actually.

So now after saving the permalinks settings I have downloaded .htaccess. Whatever changes I have to make, I’ll make in this file, without overwriting the WordPress settings for handling permalinks. Small oversights can cost you big time sometimes!