Subdomain not linking with folder

joshuahornby10 asked:

The subdomain is working and connecting to my website but linking to the root and no the folder I thought I was linking to.

<VirtualHost *:80>
DocumentRoot /var/www/html/backend
<Directory /var/www/html/backend>
Allow from all
Options +Indexes

I have checked the file structure and the file is located here

My answer:

OK, so you have two problems here.

The first problem is that the hostname you referenced in your ServerName doesn’t exist in the DNS. A different hostname does exist, though…

$ host has address has address
$ host has address
$ host
Host not found: 3(NXDOMAIN)

The second problem is that you specified a different hostname in the ServerName field than you are using in your web browser. While Apache is expecting, you are using Since Apache doesn’t know what to do with those, it punts, and you get your default virtual host.

To resolve the issue:

  1. Add a DNS record for

  2. Add ServerAlias to your virtual host.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.