Question

Ubuntu 12.04 - LAMP - WordPress : .htaccess errors

Posted March 14, 2013 21.3k views
I created a LAMPed Ubuntu 12.04 droplet, fresh from the menu. Then added fred as a root user. Logged in as fred I installed Wordpress. Everything looks great, I can add posts to the blog, but ... I cannot change the permalinks setting in the Wordpress dashboard without getting a "You should update your .htaccess now" error. There IS NO .htaccess file. So I created one in /var/www/ with the suggested settings from the Wordpress error. After restarting the apache service I still get the error when attempting to change the permalinks setting. I've chmodded /var/www/ to 777 - still get the error. I'm about to go bald through pulling out my hair. Any suggestions?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
Submit an Answer
17 answers
Edit your VirtualHost config making sure AllowOverride is set to all.
To get Permalinks working you will need to place an .htaccess file in your wordpress's web directory and add the following:

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Please also revert the permissions back on the /var/www directory as running them in 777 is not safe security.

Also you can find a full write up on Permalinks here:
http://codex.wordpress.org/Using_Permalinks#Using_.22Pretty.22_permalinks
As I said, I created the .htaccess file with the suggested settings from the Wordpress error, which was exactly what you posted. Still no joy.
This helped me when I tried bring permalink to alive

a2enmod rewrite
[SOLVED]

Even though I changed permissions on /var/www/ to 777 on all files and subdirectories, I did not go back and check the .htaccess to confirm. It was still at 644. Changed it to 666 and the permalink update worked.

Thanks all.
I am having the same problem as above. I've tried all that has been recommended:

- Enabling modrewrite and restarting apache
- Setting .htaccess permission to 666, and ensuring that it was updated by the control panel

Am I missing anything else?
Same issue here. I'm pulling my hair out with this! I should add I'm attempting to do this with apache virtual hosts.
As well as adding the .htaccess file I had to run

`a2enmod rewrite`

and then

`service apache2 restart`

This solved my problem, hope it can help others :)
Can we confirm that var/www/ is the correct "root" folder for wordpress and updating/adding the .htaccess file?

Additionally, does this apply to DO servers for AllowOverride?
https://httpd.apache.org/docs/current/mod/core.html#allowoverride
@eric: There isn't a "correct" root directory, it's just a matter of preference. You can host it anywhere you want. And yes, AllowOverride applies to DigitalOcean servers.
Previous 1 2 Next