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

We have example.org (our main site) registered and hosted on an american server. We bought example.gr domain name in Greece, a local registrar. We made .gr point at .org DNS all right. A visitor types URL .gr and sees .org in his browser all right, but URL immediately changed to .org. Is there a way to keep URL .gr and still see .org? If a .org visitor then clicks on a link to example.org/abcd.php, could a .gr visitor clicking on the same link see the address bar show example.gr/abcd.php?

Our American registrar told us to contact Greek registrar and ask for mapping. The Greek registrar basically set an iframe displaying example.org and called it example.gr. But that was wrong because obviously, each time a visitor would click on something, the address bar would always display one thing only, the same URL all the time, example.gr. So we cancelled that cheap mapping trick down, and I don't know what to do.

share|improve this question

4 Answers 4

You could make an <iframe>,

<style type=text/css>
    body{margin: 0;overflow:hidden;}
</style>
<iframe src="http://example.org/" style="border: 0; width: 100%; height: 100%" frameBorder="0">
    Browser not compatible.
</iframe>

So you'd call this index.html and put it on the example.gr server.

share|improve this answer

I wouldn't class a iframe solution the best solution, while this doesn't answer your question directly it does give you an additional and more robust never-mind a more browser friendly site.

The method that I believe is best suited for you is to use rel="canonical" on the .gr domain referring to .org as the master (no redirects). If they visit .gr they remain on .gr and vice versa on the .org. The .org will be the master for rankings purposes in Google as same as the iframe method.

So to make this possible you do the following:

  1. Clone the file contents of the site to another hosting folder so effective you have 2 hosting accounts but these are mirrored.
  2. Setup the .gr site to use the database of the .org site so both sites are exactly the same. (You may need to adjust the base_url) or use a multiple site plugin (if you don't have a SQL then even easier).
  3. You will want to use rel="canonical" on both the master .org and .gr as the slave.
  4. Optional step (you could even robots the .gr site from indexing)

Examples of rel="canonical" in action:

In the head of your master site (.org domain) you would use the following:

<link rel="canonical" href="http://www.example.org/page1"/>

In the head of your slave site (.gr domain) you would use the following:

<link rel="canonical" href="http://www.example.org/page1"/>

This basically tells Google that the master is the org, you could even go one step further and robots.txt the .gr site completely but with this method you will not get a duplicate content slap on the .gr with or without robots.

Using two domains one site WordPress

Step 1: Go to your General Settings and completely remove the "Blog address (URL)" and save.

Step 2: Add something like the below code to header.php:

$ThisDomain = $_SERVER['SERVER_NAME'];

if($ThisDomain=='example.org' || $ThisDomain=='www.example.org')
{ echo '.org stuff'; }
elseif($ThisDomain=='example.gr' || $ThisDomain=='www.example.gr')
{ echo '.gr stuff'; }

Step 3: Ensure HTTP_HOST is not set in the SQL.

share|improve this answer
    
How about if there are session cookies? –  ionFish Mar 9 '13 at 14:59
    
You should be able to store cookies based on the base_url rather than statically on the main site. So visiting .gr will give a .gr based cookie and visiting the .org will give a cookie for that domain. They shouldn't need to bounce to from one another, certainly the way the OP has posted this is not his/her intention. –  bybe Mar 9 '13 at 15:01
    
One of the reasons I mentioned a multiple site plugin as take WordPress or Joomla for example they statically set the main site, you can get plugins to overcome this so it doesn't redirect and cookies are set correctly. –  bybe Mar 9 '13 at 15:02
    
The most ideal situation would just to redirect .gr to .org but ya ;) –  bybe Mar 9 '13 at 15:05
    
I meant, how would WordPress be able to use both cookie domaines? Doesn't it only work with one domain? (I know MyBB has this limitation). ikailo.com/218/cross-domain-cookie-sharing-wordpress seems like too much work. Or this: maisonbisson.com/post/14028/… –  ionFish Mar 9 '13 at 15:12

It sounds as though you're looking for a parked domain. This is easy to set up if your web host is running cPanel.

share|improve this answer

If you're not using a shared hosting account and have access to the Apache configuration just create another virtual host with a different ServerName pointing to the same document root.

Other webservers will have a similar set up, for example just make another server {} block for nginx.

share|improve this answer

Your Answer

 
discard

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

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