Question

Second virtual host pointing to first virtual host

Hi, I know this has been asked many times before, but I couldn’t find any advice that fixes my issue.

I have a single droplet with two virtual hosts - 1. bytesizedgames.net 2. ryanmaskell.co.uk. Both are Wordpress installs, each in their own folder, /var/www/bytesiedgames.net/public_html and /var/www/ryanmaskell.co.uk/public_html.

Each has an apache config in /etc/apache2/sites-available and I’ve activated both using a2ensite and reloading/restarting apache. They look like this:

bytesizedgames.net.conf:

<VirtualHost *:80>

ServerAdmin admin@bytesizedgames.net
ServerName bytesizedgames.net
ServerAlias www.bytesizedgames.net
DocumentRoot /var/www/bytesizedgames.net/public_html

ErrorLog /var/www/bytesizedgames.net/logs/error.log
CustomLog /var/www/bytesizedgames.net/logs/access.log combined

<Directory />

Options FollowSymLinks
AllowOverride None

</Directory>

<Directory /var/www/bytesizedgames.net/public_html>

Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
Allow from all

</Directory>

</VirtualHost>

ryanmaskell.co.uk.conf:

<VirtualHost *:80>

ServerAdmin admin@ryanmaskell.co.uk
ServerName ryanmaskell.co.uk
ServerAlias www.ryanmaskell.co.uk
DocumentRoot /var/www/ryanmaskell.co.uk/public_html

ErrorLog /var/www/ryanmaskell.co.uk/logs/error.log
CustomLog /var/www/ryanmaskell.co.uk/logs/access.log combined

<Directory />

Options FollowSymLinks
AllowOverride None

</Directory>

<Directory /var/www/ryanmaskell.co.uk/public_html>

Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
Allow from all

</Directory>

</VirtualHost>

I have the A-records set up on Cloudflare both pointing to the server IP. Can’t for the life of me figure out why it’s not working so any help would be appreciated.


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.

Accepted Answer

Hi @ryanmaskell1,

The configuration files look alright! In such cases, I always tend to look at two places.

The first one is checking if you have any .htaccess redirects configured. Most of the time, people copy their already existing .htaccess files for all their websites. If you’ve copied it as well, it means every rule in the .htaccess files related to one of the websites has been copied over to the second one.

The second option would be your database, did you by any chance again copy the database from the first website to the second one? If it’s so maybe there is a hardcoded link for the first website inside the second’s database. This one is even more valid as I can see your website is using WordPress.

Regards, KFSys