Ubuntu 12.04 - LAMP - WordPress : .htaccess errors

  • Posted March 14, 2013

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?


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Edit your VirtualHost config making sure AllowOverride is set to all.

Hope this will fix your problem who are facing even after going through all the steps

sudo nano /etc/apache2/sites-available/000-default.conf

add these lines below “Document root”

ServerAdmin ServerName ServerAlias DocumentRoot /var/www/

<Directory /var/www/> AllowOverride all </Directory>

or in case of multiple websites

sudo nano /etc/apache2/sites-available/

add these lines below “Document root”

<Directory /var/www/> AllowOverride all </Directory>

then restart apache

i was running my wordpress server on var/www/public_html/blog

If i was changing permalinks with post name then it is showing 404 page. I tried many methods from this DO articles but nothing solved. help me with detailed instructions

yep, the AllowOverride in the Virtual Host config was the problem. Thanks.

Mark Provan’s answer fixed it for me, I didn’t think to do the “a2enmod rewrite” command, and that’s what fixed it.

My environment: LAMP <br> <br>What I did: <br> <br>sudo a2enmod rewrite <br>sudo service apache2 restart <br>gedit /etc/apache2/sites-available <br> <Directory /> <br> …stuff… <br> AllowOverride All <br> </Directory> <br> <Directory /var/www/> <br> …stuff… <br> AllowOverride All <br> <br><strong>Make sure you change the AllowOverride to All</strong> <br> <br>sudo service apache2 restart <br> <br>Then change the permissions so that wordpress is able to modify the file. I believe someone posted it up above, or you can find it here

@ mkstlouis: <br>Do you have multiple sites setup? If so make sure not to only edit: <br>/etc/apache2/sites-available/default <br>(setting AllowOverride to all) <br>But any other site you have enabled in that directory will need the same ‘AllowOverride all’

I spent way too many hours and recreating droplets over and over and just can’t get the permalinks to work. I was hoping to have one of my sites up to test performance and what-not. Instead I just getting really annoyed.

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

Can we confirm that var/www/ is the correct “root” folder for wordpress and updating/adding the .htaccess file? <br> <br>Additionally, does this apply to DO servers for AllowOverride? <br> <br>