Redirects are an essential part of any website, and it is crucial to understand how they work. Redirects allow specific content to be viewed by users and search engines, and there are valid reasons for each.
A permanent redirect is specified in the httpd documentation as a 301 redirect. Temporary redirects use the code 302.
A valid reason to use a permanent 301 redirect is to solve cannonical problems with domain names. Cannonical problems are subdomains such as www.site.com site.com. Some companies need multiple domain names to protect trademarks and managee potential legal requirements. Having multiple domains for one website will definitely get you into trouble.
You must choose one version of your site to display to search engines, and this is the method I use on a Linux OS running the Apache web server.
.htaccess file contents
RewriteEngine on
RewriteCond %{HTTP_HOST} ^my-trademark-protection.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.my-trademark-protection.com$ [OR]
RewriteCond %{HTTP_HOST} ^mainsite.com$
RewriteRule ^(.*)$ http://www.mainsite.com/$1 [R=301,L]
Temporary 302 redirects are good to use if you don’t wish to pass value to the referring link. A good use of a temporary redirect is linking to an affiliate site. This redirect tells search engines that the link is temporary and should not be given the same value as a 301 link.
.htaccess file contents
Redirect 301 /affiliatelink http://www.affiliatesite.com
When in doubt, use a 301 redirect as there have been problems with unscrupulous webmasters using 302 redirects to hijack website content and spam the search engines.
Happy redirecting!
One Response
Would it be useful to have more archived pages backing this up? We have thousands of outdated pages that need to be remapped.