Tuesday, March 27, 2012

Wordpress .htaccess is overidden/changed after administrative changes

I had a custom .htaccess for wordpress installation which kept being replaced after some changes ( ex: creating/updating pages ) in backend

After  investigation it appeared that wordpress is really overriding .htaccess to maintain permalinks

Solution

1- Open /wp-includes/rewrite.php which is responsible for .htaccess rewrite
2- Search for "<IfModule mod_rewrite.c>\n"
3- These are the base rules which will be saved in the .htaccess file so you need to copy your custom rules there

Add $rules .= "YOU CUSTOM RULE\n"; lines for each of your custom rules


No comments:

Post a Comment