let's assume I have two domains (one already set) and one host. I want to the second domain point to a specific folder in the host so that when you access domain2.com it points to host/myfolder so domain2.com/foo.php will be same as host/myfolder/foo.php. I hope it's clean. Is this possible?

  • 1
    What web server?? If Apache, you can simply set the DocumentRoot and <Directory> directives in the .conf file once a site is created.
    – closetnoc
    Feb 22, 2015 at 2:59

1 Answer 1


If you if you are using cpanel, it is trivial to do this. Add the new domain as an addon domain and then point the document root to your new location.

Too avoid confusion, I strongly recommend that you make the directory of your new domain /host/domain2.com so that if you add yet another domain you won't end up with a mess of confusing names.

A note of trivia: While your domain2.com/foo.php will work, so will domain1.com/domain2.com/foo.php as the second domain's folder will be sitting in the first domain's document root (assuming that is /home/user/public_html - which is the default)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.