Question
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, www.example.com and blog.example.com. 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/example.com.conf 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.
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.
×