I have a website http://www.domain1.com. Is it possible to register a second domain, http://www.domain2.com, and have it point to http://www.domain1.com/SecondDomainHere? If someone types domain2.com, I don't want them to be able to just remove the /SecondDomainHere part and be at the main website. This is for my personal use, not a business appplication, and I'd prefer to do this for awhile before getting another hosting account.

Is this technically possible? Is this done and is it acceptable? What is this called?


Possibly a question for Server Fault?

Written by Matthew Iselin

Accepted Answer

You need to set domain2.com to poiint to the same nameservers as domain1.com.

Then, on your server, set up a "Virtual Private Server". This will basically say "when a request comes to this site, if it's for domain1.com, show folderX, if it's for domain2.com, show folderY". I'm assuming Apache here but similar terminology should apply for Windows etc.

If you're on a shared web host... you may be out of luck. The best you could do is either redirect or set up a "frame redirect", where domain2.com has a frame holding domain1.com/SecondDomainHere. Problem with that is domain2.com/page.html will not link to domain1.com/SecondDomainHere/page.html AFAIK.

Written by DisgruntledGoat
This page was build to provide you fast access to the question and the direct accepted answer.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki