retlehs/roots — Issue #232: Frequent .htaccess self-corruption
Author: brianfeister
Created: 2012-01-19 16:04:10+00:00
State: open

I'm sorry that this is an intermittent issue and therefore difficult to duplicate. The problem is that intermittently, and in my opinion, frequently, the ROOTS .htaccess file self-corrupts for me.

One thing I've noticed is that it's especially common when working in local dev with MAMP. In my development workflow where I use Roots Theme for 95% of the sites I build, I would estimate that the htaccess file self-corrupts once every 8 ~ 10 hours. Obviously there are some server config issues at play here.

The reason I'm opening the ticket is to make you guys aware of it, and also, for the first time today, the issue replicated on a live web server. The client (absurdly) is hosting their site with GoDaddy, so there's no surprise there, but there is something going on which I don't understand because the .htaccess file turned out to be the source of the problem.

When this error occurs, it always happens the same way: either a 500 internal server error on a live web server, or in MAMP, the working directory of the entire site where Roots (and WordPress) are located disappear completely. The reason, as I've tracked it, is that the .htaccess file is telling the directory not to exist, so the server stops "seeing it".

Previously, when I looked at the htaccess file in MAMP local dev, I found that it had gone from hundreds of lines of code (the htaccess rewrite default with Roots Theme) to over 9,000 lines of code. I couldn't untangle it or figure much out, but the file changed itself.

In the current scenario, where it self-corrupted on the live GoDaddy-hosted web server, the file self-corrupted and the following was the result:

`
# BEGIN WordPress

RewriteEngine On
RewriteBase /cms/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/index.php [L]

# END WordPress
ustom/js/$1 [QSA,L]
RewriteRule ^img/(.*) /cms/wp-content/themes/bellyqueen_custom/img/$1 [QSA,L]
RewriteRule ^plugins/(.*) /cms/wp-content/plugins/$1 [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/index.php [L]

# END WordPress`