nafri Posted June 9, 2011 Share Posted June 9, 2011 hi got a small issue. I got a co.uk domain and a .com domain My .com domain is the main domian. I setup a 301 redirect to redirect as foloowing.. RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.co\.uk$ [OR] RewriteCond %{HTTP_HOST} ^www\.domain\.co\.uk$ RewriteRule ^/?$ "http\:\/\/www\.domain\.com\/" [R=301,L] rewritecond %{http_host} ^domain.com [nc] rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] At the moment if some one comes to my site by typing www.domain co.uk, it redirects to to www.domain.com.Now if some one comes direclty to www.domain.co.uk/product-2364.html then it doesnt redirect to www.domain.com/product-2364.html. Can some please have a look at the above and advice a better way to manage this. kind regards nafri Link to comment Share on other sites More sharing options...
ozEworks Posted June 9, 2011 Share Posted June 9, 2011 If you use a hosting panel like Cpanel you can park the domain and redirect as well and it will handle the .htacess entries for you. I looke at one of mine done that way and this is what is in hte .htaccess RewriteCond %{HTTP_HOST} ^parkeddomain.com$ [OR] RewriteCond %{HTTP_HOST} ^www.parkeddomain.com$ RewriteRule ^/?$ "http\:\/\/www\.livedomain\.com\/" [R=301,L] Link to comment Share on other sites More sharing options...
MrPhil Posted June 9, 2011 Share Posted June 9, 2011 It's failing to redirect because your code only handles the "empty" case: [www.]domain.co.uk or [www.]domain.co.uk/. Try this: RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?domain\.co\.uk$ RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L] I don't think you'll run into any problems with both "301's" trying to fire at once, so this should work. Mind you, this will tell anyone coming in to .co.uk that your "real" site is .com, and they should use only that domain. This may hurt you in search engine rankings in the UK (only your .com will be cataloged, due to the 301 redirect). You might want to consider the SEO implications of this (effectively getting rid of your .co.uk domain) and use a 302 redirect instead. If your intent is to eventually drop the .co.uk domain, go ahead with the 301. Link to comment Share on other sites More sharing options...
ozEworks Posted June 9, 2011 Share Posted June 9, 2011 Running both domains as they are now will impact his SEO as both would get indexed with same content which is not a good idea. If the businesss is UK based then I recommend you run the site as the co.uk and park with redirect the .com on it. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.