Question

WordPress Permalinks Broken

Posted April 9, 2013 34.4k views
I followed the guide on installing Wordpress on Ubuntu 12. Everything is working fine, except for when I change my permalink structure to Month/Post Name. The main blog page works, but post links throw a 404 error. I tried a few things: - Enabled mod_rewrite with a2enmod rewrite and restarted Apache - Set permissions to .htaccess to 777 so Wordpress could update the file as needed when I updated the Permalink settings. Is there something else I'm missing here to get this working?
2 comments
  • I am having problems. When I open the /etc/apache2/sites-available/default file in the console - it is a blank screen? this is a brand new droplet

  • Anyone find a solution to this?

    I just followed all the instructions and when I pull up my Wordpress site that is now on the DO droplet, I get the main page and even can go to Dashboard, but many of my pages and links are PAGE NOT FOUND!

    I’ve tried the Permalinks resetting tips of saving the format again, but that doesn’t help.

    I’ve even made sure my .htaccess file still have the following:

    BEGIN WordPress

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

    END WordPress

    No change.

    What am I missing?

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
16 answers

Permalink Problem

Inside of this file, we want to change all things.

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

000-default.conf - should look something like this:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/html

        <Directory /var/www/html/>
            Options Indexes FollowSymLinks
            AllowOverride All
            Require all granted
        </Directory>

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

When you are finished, save and close the file.

Next, we need to enable the rewrite module, which allows you to modify URLs. You can do this by typing:

sudo a2enmod rewrite

After you have made these changes, restart Apache:

sudo service apache2 restart
If you've followed the initial steps and you've not been able to get rewrite to work for you, do the following :::

Firstly it's important you restart the apache2 server without any errors, ( Restarting web server apache2 : error ... ) ::: If you do get this error do the folllowing :::

1) sudo nano /etc/apache2/httpd.conf
2) Add, ServerName localhost


Open up the following file, and replace every occurrence of "AllowOverride None" with "AllowOverride all"

1) sudo nano /etc/apache2/sites-available/default
2) sudo service apache2 restart
There is a discussion of this here:

https://www.digitalocean.com/community/questions/ubuntu-12-04-lamp-wordpress-htaccess-errors

Thanks Etel - I've tried all that's recommended in that thread to no success. I will also respond to that thread.
@Michael's solution of adding "AllowOverride all" worked for me. (Note: "all" should be in lower-case)

I listed all the steps it took to get this working for me below:

http://randomwordpresstips.wordpress.com/2013/05/10/enabling-permalinks-on-wordpress-install-ubuntu-12-10/

P.S:
only comment on michael's reply : There is no httpd.conf in ubuntu's apache2. My server restart kept complaining the below error but it did not affect permalinks or my blog

error:
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
That is just a warning, you can ignore it - it won't affect anything.
@narenlog On that system the configuration files are in `apache2.conf` rather than `httpd.conf`. Add the `ServerName localhost` line to that file and you'll get the desired result.
this work for me
http://randomwordpresstips.wordpress.com/2013/05/10/enabling-permalinks-on-wordpress-install-ubuntu-12-10/

thanks
Answer by Michael worked, Thank you.
But if I try to log in to WordPress (/wp-admin) it redirects to IP instead of using domain.com/wp-amdin it uses 111.111.111.11/wp-amdin
@abachuk: Are you still experiencing this issue?
Previous 1 2 Next