• I had a number of sites on a hosting package which I am in the process of moving to a Digital Ocean droplet running Ubuntu, Apache, php and MySQL.

    I had the common problem of all permalinks being broken and followed the advise to recreate them by saving them from the wp dashboard.

    This wasn’t working although I could see that it was creating a .htaccess file in the public_html folder.

    I also created a new test site and found that could not create links either so I knew it was not a migration issue.

    After a lot of searching I and some help from someone who knows a lot more about LAMP servers I found the solution.

    It seemed like something wasn’t allowing wordpress to modify the database when permalinks were saved.

    Solution:

    There was a problem with the Apache configuration which for some reason wasn’t mentioned in the Digital Ocean guides to setting up LAMP.

    In the file /etc/apache2/apache2.conf I changed ‘AllowOverride’ from ‘None’ to ‘All’:

    Now it looks like this:

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

    Hopefully this will be helpful to someone using WordPress on LAMP.

Viewing 4 replies - 1 through 4 (of 4 total)
  • In the file /etc/apache2/apache2.conf

    That enables permalinks globally. That’s okay if you’re really sure it’s what you want to do, but I think enabling it by placing the directive in each sites virtual host configuration is pretty common.

    /etc/apache2/sites-enabled/sitename

    Thread Starter r4debe

    (@r4debe)

    Thanks for the reply.

    That’s interesting. So I would put:

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

    anywhere inside the <VirtualHost> tags?

    I don’t mind it being global as long s it’s not a security risk since I use wordpress. But it’s always useful to know how things work.

    I’m puzzled as to how this doesn’t seem to be mentioned in the Digital Ocean guides, which are very good.

    I was convinced it was a problem with my server and not WordPress as there were no threads younger than 3 years anywhere I could find.

    With ubuntu, all it usually takes is

    a2emnod rewrite , then as you say, something along these lines at least within the directory container for each virtual host.

    <Directory /var/www/html>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>

    That would work for the default virtual host, but of course the directory would change with each host configuration.

    I was convinced it was a problem with my server and not WordPress as there were no threads younger than 3 years anywhere I could find.

    Technically, just a minor configuration error in the the virtual hosts file.

    I’m puzzled as to how this doesn’t seem to be mentioned in the Digital Ocean guides, which are very good.

    You may be more likely to pick up some info in the DigitalOcean community discussions. site:digitalocean.com/community permalinks ubuntu – Link Goes to Google

    I cruised through this article pretty quickly, but here’s a link to a DigitalOcean tutorial that describes how to use pretty permalinks on Ubuntu with WordPress – https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-on-ubuntu-14-04 – See Step Six (Optional) — Configure Pretty Permalinks for WordPress – it looks like it covers the basic virtual host configuration for permalinks.

    Thread Starter r4debe

    (@r4debe)

    Great, thanks for the info.

    I thought I must have missed something.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘links don't work wordpress on LAMP – apache2 config’ is closed to new replies.