Im migrating my website from the .co.uk to the .com but need to setup a 301 redirect so all of the individual pages will still be routed properly.
ie i want http://www.mydomain.co.uk/shopping/product1 to go to http://www.mydomain.com/shopping/product1
I have done this before but for the life of me cannot remember how.
many thanks
paul
To 301 Redirect an Entire Domain:Replace http://www.new-domain.com/ with the URL that you would like your site to redirect to. Be sure to add a blank line at the end of your . htaccess document.
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.co\.uk$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]
This redirects both the www and non-www for mydomain.co.uk to www.mydomain.com.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With