Question

How to let subdomain takes document root of main domain

I Need to have my subdomain to show the same files and database of the main domain without moving or duplicating the files to another directory, how to achieve this in DO (vestaCP is installed) in main domain i have the 3 usual ns records and A record pointing to ip in the subdomain I have only the 3 usual ns records


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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Log in to cPanel. In the Domains section, click the Addon Domains or Subdomains icon, depending on which you’d like to modify. Locate the addon domain (or subdomain) you wish to modify. Click the pencil icon next to the current document root for the domain you wish to modify.

Hi there,

The first thing that you would need to do is to add a new A record for your subdomain name and point it to the Droplet IP address. For more information on how to add DNS records, you could follow the documentation here:

https://docs.digitalocean.com/products/networking/dns/how-to/manage-records/

After that, you would need to log in to your VestaCP and add the subdomain name as a domain alias under your main site. You should be able to do that by clicking on Web (domain.com) > Edit > and add the subdomain to the Alias list.

Hope that this helps. Regards, Bobby