WordPress 3.1 .htaccess contents keep dissappearing?

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.

Read More

Thanks.

Related posts

Leave a Reply

1 comment

  1. 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.