WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've used some custom rewrites implemented by the Roots framework. Occasionally they get wiped: certainly if I visit Settings > Permalinks, but also at seemingly random times.

My htaccess reads so:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

RewriteRule ^css/(.*) /wp-content/themes/the-hit-centre/css/$1 [QSA,L]
RewriteRule ^js/(.*) /wp-content/themes/the-hit-centre/js/$1 [QSA,L]
RewriteRule ^img/(.*) /wp-content/themes/the-hit-centre/images/$1 [QSA,L]
RewriteRule ^plugins/(.*) /wp-content/plugins/$1 [QSA,L]
RewriteRule ^media/(.*) /wp-content/uploads/$1 [QSA,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

I've tried removing the

# BEGIN WordPress

comments, but then WP just writes a new block of code.

Is there a hook I can call in functions.php that will prevent WP refreshing the permalinks?

thanks, Tim

share|improve this question
up vote 0 down vote accepted

There is a # BEGIN WordPress and # END WordPress after the end you should be able to add your own code. Anything between will get overwritten by WordPress

share|improve this answer
example code here whypad.com/posts/… – Drai Mar 1 '12 at 22:50
Thanks Drai - I'll follow whypad's lead and double up on the <IfModule, RewriteEngine On business.. The other approach I considered was to set .htaccess as not writable... Thanks! – ptim Mar 2 '12 at 5:38

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.