I have the domain
example.com and have set up the Ubuntu Apache server in a way that it points any subdomain to a directory with the same name.
<VirtualHost *:80> ServerAlias *.example.com VirtualDocumentRoot /var/www/html/%1 </VirtualHost>
subdomain.example.com will point to
I am trying to allow users point their own custom domain to a subdomain of their choice, how could I achieve this and what records would be required and what would have to be done to the Virtual Host?
I have tried the following record:
sampledomain.example(CNAME record) -
sampledomain.example(A record) -
IPAddress of example.com)
I have also tried using
www for the CNAME along with removing the
sample.example.com successfully points to
sampledomain.example acts like the root site for some reason.
So if I visit
sampledomain.example/sample, I will get the contents of
example.com/sample rather than pointing to
How could I sort this out? Which records would be needed and what could be done to the Virtual Host?
I used a CNAME record so that I can retrieve the custom domain name via PHP when the user visits that - is the CNAME required?