Question

Why does my subdomain point straight back to my main website login page?

Posted November 27, 2021 131 views
Networking

So, I was expecting my subdomain to be an entirely different environment where I can add different code. Ok - I have not waited the whole 3600 seconds. Will that change or have I done something wrong?

OK, So I am following the docs, on how to create a subdomain:
https://docs.digitalocean.com/products/networking/dns/how-to/add-subdomain

When entering the new subdomain host field it automatically appends this to my existing domain name, so mysubdomain.mymainsite.com.

Then, the “will direct to” field is automatically filled with the “mymainsite”. The resulting DNS A record comes out as “mysubdomain.mymainsite.com”.

Here is the kicker: when I enter into my browser, “mysubdomain.mymainsite.com”, it just goes straight to the login page for “mymainsite.com”.

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.

×
Submit an Answer
1 answer

Hello,

This does not sound like a DNS problem, as if it was a DNS problem, you would be getting an error saying that the subdomain can not be resolved and it would not load at all.

It sounds like a server configuration issue.

In case that your main domain and subdomain are hosted on the same server, you need to make sure that you have done the necessary server-side configuration in order to be able to host two separate websites.

For example, if you are using Apache, you need to make sure that you’ve added a new Apache virtual host as there the instructions here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-18-04

Or if you are using Nginx, you need to make sure that you’ve setup separate Nginx server blocks as per the steps here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-nginx-server-blocks-virtual-hosts-on-ubuntu-16-04

If you are using WordPress, you could take a look at this video here:

Best,
Bobby

by Justin Ellingwood
When using the Nginx web server, server blocks (similar to the virtual hosts in Apache) can be used to encapsulate configuration details and host more than one domain off of a single server. In this guide, we'll discuss how to configure server blocks in Nginx on an Ubuntu 16.04 server.