How to point .co.uk and .com to the same site?

Discussion in 'Apache' started by ams, Mar 18, 2007.

  1. #1
    Hi,

    I want to point my .co.uk and .com domain to the same site so they could be accessed from uk and usa but with respective .com and .co.uk ext without users being knowing it.

    Someone has suggested some configuration changes in the .httpd.conf file of apache but I am not sure what i.e server alias or servername etc.

    How can I achieve it?

    thanks
    ams
     
    ams, Mar 18, 2007 IP
  2. oziman

    oziman Active Member

    Messages:
    199
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    put this in the .htaccess of the .co.uk domain.

    
    Options +FollowSymLinks
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^www.uksite.co.uk
    RewriteRule ^(.*)$ http://www.ussite.com/$1 [r=301,L]
    Code (markup):
     
    oziman, Mar 19, 2007 IP
  3. ams

    ams Peon

    Messages:
    212
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    oh, ok.

    thanks a lot for your help!!
     
    ams, Mar 19, 2007 IP
  4. WiredTree Zac

    WiredTree Zac Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That will work. You could also add the domains you want going to the same place in the ServerAlias section of the VirtualHost in httpd.conf .

    So, for example if the VirtualHost was for DOMAIN1, you would add:

    ServerAlias DOMAIN2 DOMAIN3
     
    WiredTree Zac, Mar 19, 2007 IP
  5. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #5
    oziman's post will not do this. He posted an htaccess code that will 301 redirect all your users on the .co.uk domain to the domain.com (and update the browser's address bar). If you want to avoid any possible duplicate content issues, you should probably go for this option but it's not what you originally asked for. WiredTree Zac has posted the correct solution.
     
    rodney88, Mar 19, 2007 IP
  6. ams

    ams Peon

    Messages:
    212
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    right...making some sense now that as an alias it can refer to both the domains and not impacting/restricting redirects.

    great stuff!!

    thanks WiredTree Zac and rodney88!! thanks to oziman for input as well.
     
    ams, Mar 19, 2007 IP
  7. oziman

    oziman Active Member

    Messages:
    199
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Rodney - I live in the world of search.. I can't ethically provide a solution that will create duplicate content :) You are correct that the VirtualHost solution is probably the better one from a tech point of view..
     
    oziman, Mar 20, 2007 IP
  8. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #8
    I'm not complaining mate - he asked for something that allowed both domains to show the same thing and you gave him something that redirected visitors on one domain to the other. That's fair enough but no one mentioned the difference so I just wanted to make sure ams knew what he was getting.
     
    rodney88, Mar 20, 2007 IP
  9. klittl06

    klittl06 Peon

    Messages:
    88
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #9
    You could setup one as a virtual server and then make the other a ServerAlias and that will do it.

    OR

    You could have your DNS do a webforward to the other domain name. This would probably be better if you would prefer everyone to use one domain over the other.
     
    klittl06, Mar 23, 2007 IP