Here’s the situation. I have a site, mydomain.com. I also own the similarly named mydomain.org. All of the files are hosted at the mydomain.com server. Mydomain.org is strictly a domain name, without files of its own.
I want the following to happen:
When person A types in “http://www.mydomain.org/specialpage.html” and person B types in “http://www.mydomain.com/specialpage.html”, they will both be directed to the same page, hosted at the mydomain.com server.
But, the .com and .org suffixes in the location bar will remain as they were when the people typed them, so that person A will continue to navigate around mydomain.org and person B will continue to navigate around mydomain.com.
What do I need to do to my DNS settings in order to accomplish this?
The only thing you need to change in your DNS settings is to make yourdomain.org point to the same IP as yourdomain.com.
Then, you will need to alter your web server configuration to respond to both domains with the same documents, if it doesn’t do so already.
I don’t think it’s a DNS issue. Multiple domain names can resolve to the same IP address. It’s the job of the web server software to interpret URLs.
If you’re using Apache, I think what you want is ServerAlias (once you’ve got all the DNS entries pointing to the right place).
The OP wants something slightly different: he wants two seperate sites, but they share a common part. It’s quite easy to set up a simple link from one to the other, but you do change websites. If you want the website name to stay the same while maintaining a common block, that’s rather more tricky. Presumably the common block is non-trivial?
friedo has it right.
Make sure the DNS for each domain points to the same IP address.
Then make sure your web server software directs requests for pages at either domain name to the same “site” on your server.
If you’re using IIS as a server on Windows, this is done using the “Web Site Identification” for the web site. Open IIS Manager, find the web site, right click and select properties, and on the “Web Site” tab, look at the section for “Web Site Identification”. Click the “Advanced” button and you’ll see you can enter any number of URLs that will be directed to this web site. I usually put both the normal URL ( www.mydomain.com ) as well as the domain only ( mydomain.com ).
The URLs can be anything, they don’t have to be similar, or bear any resemblance to the actual domain name. Of course, keep in mind that unless the DNS record for the domain points to your IP, putting www.google.com in your web site identification isn’t going to grab Google’s traffic. So you would only enter URLs for domains you own. But they can totally different domain names.
One thing to watch out for are links between pages on your site. If your links have the full URL (e.g. pageone.html has a link to www.mydomain.com/pagetwo.html) then obviously the domain displayed in the address bar on the browser is going to be the .com address and not the .org address after you click that link. But if you always use relative links the URL in the address bar will retain the domain name the user started with.
I’m not sure how it’s done in Apache, MrSquishy says with an alias.
It can be done with a ServerAlias, or you can set up two separate virtual hosts pointing to the same document root. The latter configuration offers more flexibility if you want different configurations for each domain. For example, with two separate vhosts, each domain could have its own logfile.
Thanks, all. I’m on Windows, so RJK’s specific info. was very useful. I pointed my .org’s A record at the server’s IP address, and edited the .com’s IIS info. as recommended by RJK. The DNS changes finally went through after 12 hours. Sheesh. Wish I could change that host’s TTL, but they don’t allow it.