Wordpress Permalinks not working on Ubuntu 14.04

September 24, 2014 81.8k views

I have followed this guide, and everything worked correctly except that I cannot change the Wordpress permalink setting. I have followed the guide, and other solutions to questions here, but none are working for some reason.
On WP, when I change the permalinks, and go to the original domain.com/?p=123, it changes the url to the correct domain.com/month/day/post-title, however it takes me to the apache 404 page then.

Any help is appreciated.

1 comment
  • To clarify, the problem in this scenario is that .htaccess is not enabled. To fix that, you add AllowOverride All for your site’s directory. In my case, I did that in apache.conf.

6 Answers

I had this issue with pretty permalinks myself, and the solution was to edit my vhosts conf file for that site. Here’s what worked for me:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName broseph.com.au

    DocumentRoot /var/www/broseph.com.au/public_html
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    <Directory /var/www/broseph.com.au/public_html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

  • Also make sure your .htaccess file has the proper permissions for WP to write to it. You’ll see an error if it doesn’t.
  • FYI: conf files are in /etc/apache2/sites-available
  • Don’t forget to restart apache after editing the conf file: sudo service apache2 restart

My issue was from making the update from Ubuntu 12.04 to 14.04 was that my apache2.conf was not correct configured:

In terminal type:

sudo gedit /etc/apache2/apache2.conf


<Directory /var/www/>

And make sure the AllowOverride directive is set to All.

After I made that change I could use custom permalink structures in Wordpess again, hope this helps anyone as it did me!

you have to enable moderewrite.c for apache
more info
after enable mode
rewrite , make sure you have .htaccess file in the public_html :

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

and restart the apache server

sudo service apache2 restart

I was having a similar issue. The website would work on the home page and I could log into WordPress admin, but if I clicked on any other link it resulted in a 404 error.

The page that is linked to in some of the other answers isn’t the ideal solution. Basically, it turns on AllowOverride to “All” which allows .htaccess files to work. This is great when you are on shared hosting with no access to the apache configuration file, but shouldn’t be used when you are on a host such as digitalocean, where you have access to the server configuration file.

The ideal solution is to put the information that is in the WordPress .htaccess file into the main apache configuration file. This helps to improve the server performance. This page shows how to do it and why: http://haydenjames.io/disable-htaccess-wordpress-performance/

Thank you so much! XD

Have another answer? Share your knowledge.

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