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.

KFSys
Site Moderator
Site Moderator badge
November 18, 2020
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

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.