Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have Wordpress 3.1 installed in a subdirectory of a shared hosting account, it's a linux server and mod_rewrite is enabled and working fine elsewhere. The contents of the .htaccess file disappear whenever I try and change the permalinks structure, leaving just the begin/end wordpress comments with nothing in between.

I have no plug-ins installed.

Thanks.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

By default, this shouldn't be happening. My guess is that this is an oddity with your hosting provider. I would also guess that the.htaccess file is world writable. I would try making the .htaccess file mode 644 like so:

chmod 644 .htaccess

or by using your SFTP program of choice to make it only writable by Owner. Then, whenever you modify the permalinks settings, just copy and paste the results at the bottom of the permalinks page into the .htaccess file manually.

Just as a note: having the .htaccess file world writable is a fairly substantial security issue on a shared hosting provider. Depending on how things are set up, it can be easy for someone on the same server to inject behaviours you don't want into your site by modifying this file.

Edit: I had 600 originally, which works for me because I have the .htaccess file owned by the www-data user on my server... but I should have said something about that. As per the comment below, 644 or 444 makes more sense in most cases.

share|improve this answer
    
Thanks a lot, strangely the file was never world writable but only owner writable. I had to change the permissions to 444 to stop the contents being erased. –  Will Mar 28 '11 at 13:52
    
Glad this helped! I've updated my answer based on your feedback. 444 or 644 makes more sense in the general case. –  Gavin Anderegg Mar 28 '11 at 14:12

Your Answer

 
discard

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.