Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have two domains: www.domain1.com and www.domain2.com. I want to implement the following scenario:

Whenever a user enters www.domain2.com, the browser should display contents of www.domain1.com but the URL should remain www.domain2.com.

How can I implement this?

share|improve this question

migrated from stackoverflow.com Jan 23 '12 at 5:08

This question came from our site for professional and enthusiast programmers.

    
You need to add more detail. What's the underlying platform? Which technology stack do the two site use? More detail == better answer. –  Abbas Dec 26 '11 at 16:32
    
Hi Abbas, www.domain2.com is just a domain purchased from goDaddy.com and web site is hosted in another domain that is domain1.com. The hosting provider is discountasp.net and written in Asp.Net. –  Varun Sharma Dec 27 '11 at 20:17
    
www.domain2.com is just a domain and not a webhosting.. It is like I have registerd a domain but without any hosting plan. –  Varun Sharma Dec 28 '11 at 6:35

3 Answers 3

Since you are using GoDaddy for domain2 you can take advantage of their masking solution for domain redirects. This allows the visitor to domain2 to visit domain1 while still seeing domain2 in the address bar. The masking option is part of the redirect option within your GoDaddy domain control panel. More info can be found in the help files here: http://help.godaddy.com/article/422

share|improve this answer

You should use a CNAME DNS record. So when users are on domain2.com they see content from domain1.com without using an iframe which isn't that good IMO

http://rscott.org/dns/cname.html

share|improve this answer
    
Of course, for this to work, the webserver at domain1.com must be configured so that it accepts requests for pages on domain2.com and returns the same content as for domain1. But yes, as long as you take care of that, this is IMO the best solution. –  Ilmari Karonen Mar 17 '12 at 23:37
    
@IlmariKaronen As long as you registered domain1.com and have control of it's DNS, same for domain2 there is no configuration on the server that need to be made to setup a CNAME other than name server and DNS control. –  Anagio Mar 18 '12 at 0:28
    
If your webhost is using name-based virtual hosting (which it most likely is, unless you run your own private server and have only one site running on it), it determines which content to send based on the original, unresolved hostname sent by the browser in the Host header. If the hostname it sees isn't anything it recognizes, it will show either an error message or some default page that is probably not what you want. –  Ilmari Karonen Mar 18 '12 at 0:59
    
Read their question and comments they dont have hosting for domain2, it's pretty simple. User's go to domain2.com and see the content of domain1.com the most common way to do this is a CNAME record, they work just as well on shared hosting accounts. –  Anagio Mar 18 '12 at 1:04
    
Anagio: Why don't you try it? Set up a hostname on your own domain with a CNAME pointing to, say, webmasters.stackexchange.com, and see if you can get the content from this site to show up on your hostname. (Spoiler: it won't work.) –  Ilmari Karonen Mar 18 '12 at 1:10

you can use iframe and put its src to your domain1.com and it width and height to 100% with no border.

<IFRAME SRC="www.domain1.com" TITLE="Domain 1">

</IFRAME>

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.