WordPress 3.1 .htaccess contents keep dissappearing?

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.