How to make .htaccess writeable for wordpress?

sil0r picture sil0r · Dec 1, 2015 · Viewed 14.5k times · Source

I have Wordpress running on a dedicated centos server with Buddypress installed . Buddypress requires pretty permalinks. Therefore I changed i to /%postname%.

Somehow it did not work because Buddypress is not working correctly and Wordpress suggests to create the .htaccess myself :

"If your .htaccess file were writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all."

I have tried every hint I found but somehow it does not work. Here is a list:

  • mod_rewirte is enabled
  • .htaccess was created and filled with wordpress suggested information
  • .htaccess was set to chmod 777
  • FollowSymLinks and AllowOverride All was set in the httpd.conf

Is there anything else I can do?

Thanks in Advance

Answer

Panama Jack picture Panama Jack · Dec 2, 2015

None of those things will make a difference if your ownership is wrong. The reason wordpress can't write to it is because the file is probably owned by another user instead of web server. I've seen this numerous times.

To fix this issue, first change the permission back to a more secure permission using this from the command line.

chmod 644 .htaccess

Then change the ownership/group of the .htaccess file to web server user.

For CentOS/RHEL

chown apache: .htaccess

For Ubuntu/Debian

chown www-data: .htaccess

Now wordpress should be able to right to this file.