1

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.

1 Answer 1

0

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.

2
  • 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, 2011 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. Mar 28, 2011 at 14:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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