Unable to get Wordpress to work on Apache Virtual Hosts

I’m new to servers and Linux in general so pardon me if this is a stupid question.

I’ve been trying to host multiple Wordpress installations on a single droplet. Specifically, I want to host multiple sub-domains. Such as, and I own the domain, and I have setup A records in the DigitalOcean DNS for each of the subdomains.

Apparently Apache Virtual Hosts should let me set up multiple websites on a single server. I followed the DigitalOcean guides on setting up the Virtual Hosts to the letter, but I keep running into a certain error. That is, after I install the virtual hosts, the permalinks don’t seem to work. The website works fine as long as I keep the permalinks in the default format. But the moment I try to change to a custom permalink structure, the whole Wordpress breaks. I can still login, but all posts throw a 404 error. I’m also unable to ‘hide backend’ by changing the URL of the /wp-admin page.

I have checked the .htaccess file as well as the Apache sites-enabled/ files to make sure everything is correct. I’m 90% sure I did this right. But I might have missed something.

I’ve attempted to setup the server twice now using the Wordpress One-click installation. I’ve attempted it again, starting from Ubuntu 18.04 and manually installing the LAMP stack, but I ran into the exact same issue. I can’t provide a website link right now because I wiped the server and did without the Virtual Hosts for now, so my website is working (albeit without any subdomains). But if it’s needed I can open a new Droplet and replicate the issue.

If anyone has any idea what is going on, I would love some help. Thanks!

TL;DR - Tried to set up Apache Virtual Hosts for subdomains, but the permalinks don’t work.

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

I actually found the specific reason why it didn’t work.

If following the digitalocean LAMP stack guide (I haven’t tested the one-click application), after installation, run the command:

sudo nano /etc/apache2/apache2.conf

Look for the section that says:

        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted

and change the AllowOverride line to: 

```AllowOverride All```

That solved my issue completely. Hope it helps for you too. 

thanks, i’m also new on this site

I managed to solve the issue. I followed a non-DigitalOcean guide. The main difference was that the new website files were stored in the /var/www/html/ instead of /var/www/ I also didn’t have to play around with .htaccess files either.

I am not sure what caused it to work, but it works now. If anyone can explain the difference, though, that would be nice.

I tried to link the guide here, but my reply was rejected as spam. I’d say just google it.