Hello, I need to point my .co.uk domain to my .com domain, I have been adviced that the best and most SEO friendly way to do this is with a .htacess file. Can anyone explain to me how this is done. Many Thanks.
Done a bit of reading does this look correct? Redirect www.xxxxxxxxxxxx.co.uk http://www.xxxxxxxxxxxxx.com
You can hard 301 a domain like that from your hosting panel if need be. That said no, that is not an apache directive. Nigel
If your site is hosted on an Apache web server then you should have access to mod_rewrite. If the DNS entries for your .co.uk and .com domains both resolve to the same IP with the same root folder for the web then putting the following in a .htaccess in the root of the web should fix it: NOTE: The first rewriterule: redirects all requests on your new .com domain for the non-www version to the www version of the URL to prevent your new web from having URL canonicalization issues. The second rewrite rule: is what actually redirects all page requests for the old .co.uk domain to the exact same page name on the new .com domain. However, if your DNS is set up so that your .co.uk domain is pointing (and will continue to point) to a different IP or even a different folder on the same IP than the .com domain is pointing to then add the following to the .htaccess folder in the root folder of the co.uk domain's web: And add the following to the .htaccess in the root of the .com web to make the www version of URLs your canonical URL:
Thank you very much for this useful information Canonical. What I think I am going to do is a redirect through my web host itself. However I do want to prevent the issues of www. and no www that you spoke of my .htacess file has a lot of Joomla code. Could you show me where I should position the code you recommended:
I have followed your advice and included the following in a .htacess file that is in the root directory of my old site: But it isn't working, I've done some hunting around on google and the only info I can find is on 301 redirects and the code used in there looks a lot different to this that you've given me.
I actually mispoke. You 301 a domain from the registrar not your host. Sorry. Canonical's advice should work as well though. Nigel
This .htacess file I just mentioned isn't working. Should I do a 301 redirect or is this bad for SEO?