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
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):
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
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.
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.
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..
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.
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.