{"id":180,"date":"2007-04-24T11:07:00","date_gmt":"2007-04-24T11:07:00","guid":{"rendered":"http:\/\/digitalsrc.com\/blog\/301-redirect-comprehensive-guide-to-url-redirection\/"},"modified":"2018-09-13T06:59:25","modified_gmt":"2018-09-13T06:59:25","slug":"301-redirect-comprehensive-guide-to-url-redirection","status":"publish","type":"post","link":"https:\/\/digitalsrc.com\/blog\/301-redirect-comprehensive-guide-to-url-redirection\/","title":{"rendered":"301 Redirect &#8211; Comprehensive Guide to URL Redirection"},"content":{"rendered":"<p>Canonical URLs and issues with URL redirection have been a major concern for most webmasters. While many webmasters have been badly bitten by the canonical URL issue, some others who tried to implement a redirection ( to avoid canonical issues) but couldn&#8217;t implement it properly are often bitten as hard, or even worse.<\/p>\n<p>Though Google has implemented an option for suggesting the preferred URL in their <a href=\"http:\/\/www.google.com\/webmasters\/\">Webmaster Central<\/a>, where a webmaster can log in and specify the URL form that he wants Google to consider, the other major search engines are yet to reach that point. Also, there are still many webmasters who are not aware of this feature offered by Google&#8217;s Webmaster Central.<\/p>\n<p>In addition URL redirection can be a very useful method in various other occasion, particularly if you are moving your site or re-developing it &#8211; that causes change in URLs that are already indexed by the search engines. I am sure none of us want to take the pain to start from scratch to work with new URLs or to lose all the back links that your old site might have earned through the years. Effective URL redirection can actually save you from all these.<\/p>\n<p>I have tried to create a comprehensive guide on the types of redirection and the ways to implement them.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Types of Redirection<\/strong><\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>301 Redirection <\/strong>&#8211; This is the most SEO Friendly redirection. This is actually a function of the web server that redirects a visitor from the current page to the new page and returns a response code that says that the original page has been <strong>Permanently<\/strong> moved to the new location. Search engines identify this redirection very easily and credit the new URL with all the back links and PageRank of the old URL. This type of redirection is expected to have the least impact on the search rankings.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>302 Redirection &#8211;<\/strong> A 302 redirection should be used when you want to redirect your visitors to a new page for temporary period. This is a function of the webserver that redirects visitors to the original page to a new page and send a response code that says that the page has been <strong>Temporarily<\/strong> moved to the new location. Search engines often have trouble to decide on how to treat this type of redirection and this can actually effect your search rankings. It is advisable that you try to avoid 302 redirection as much as possible (unless it is actually a temporary move).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>Meta Redirect &#8211;<\/strong> This is a client side function done using the Meta-refresh tag. Traditionally it was believed that use of Meta-refresh tag might lead to penalty or ban from the search engines because of the immense misuse of this feature by several sites that served a keyword rich optimized page to the search engines and then redirected the users to the actual page. However, as per recent updates it seems search engines are a little better in handling this type of redirects but the concern is most of them are having a different policy on how they treat this redirects. Most of them though treat this as a form of 302 redirection and hence it is not at all recommended, if you have SEO in mind.Though there is no official statement from Google , from the word of mouth information it appears that they treat a Meta redirect as 302 redirection. Yahoo however, has clearly outlined there <a href=\"http:\/\/help.yahoo.com\/help\/us\/ysearch\/slurp\/slurp-11.html\" target=\"_blank\" rel=\"noopener\">policy about handling redirections<\/a>, stating that they treat Meta redirects set to 0 seconds (&#8220;little or no delay&#8221;) as 301 redirection and anything above 0 seconds (&#8220;noticeable delay&#8221;)is treated as a 302 redirection. <a href=\"http:\/\/search.msn.com\/docs\/siteowner.aspx?t=SEARCH_WEBMASTER_REF_Redirectcode.htm\" target=\"_blank\" rel=\"noopener\">MSN<\/a> does not drop the original URL from their index on adding the Meta Refresh tag but also indexes the new URL, which indicates that they are treating Meta Redirection as 302 redirect.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>How To Implement 301 Redirection \/ Website redirection <\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>Redirection can be implemented at two levels. Server Side redirection can be either a 301 redirection or a 302 redirection, however, as 301 redirection is the most search engine friendly method, I have explained the 301 redirection only in this article.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><strong>Client Side Redirection <\/strong>\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#meta\">Meta Redirect using Meta Refresh<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#js\">JavaScript Redirect<\/a><\/li>\n<\/ul>\n<\/li>\n<li><strong>Server Side Redirection<\/strong>\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#php\">301 Redirection in PHP<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#vb\">301 Redirection in ASP ( VB Script )<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#jscript\">301 Redirection in ASP ( JScript )<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#net\">301 Redirection in ASP.Net ( C# )<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#cfm\">301 Redirection in Cold Fusion ( CFM )<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#jsp\">301 Redirection in JSP \/ JAVA<\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li><a href=\"http:\/\/seo-kolkata.blogspot.com\/#cgi\">301 Redirection in CGI \/ Perl <\/a><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong><a name=\"meta\"><\/a>Meta Redirect ( Using Meta Refresh Tag) <\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Add this line in between HEAD tags of your webpage to redirect that page in 0 seconds to http:\/\/www.newurl.com. You can increase the delay in redirection by changing &#8220;0&#8221; to some other value. Remember to replace http:\/\/www.newurl.com with the actual URL of your new page.<\/p>\n<p>&nbsp;<\/p>\n<p><strong><a name=\"js\"><\/a>JavaScript Redirect ( NOT RECOMMENDED !! ) <\/strong><\/p>\n<p>JavaScript redirection is another common form of client side redirection however it is not at all recommended from SEO perspective. In most cases the search engines would simply ignore trhe JavaScript and stay on the current phase. In most cases JavaScript redirects are not looked upon as a favorable practice as this technique has been massively misused by certain industries. The common trick was to have a keyword stuffed pages redirecting to the actual page in 0 seconds. The search engines would not be able to read the JS and index the keyword stuffed pages where as the visitors would be redirected to the actual page by the JavaScript. Search engines today are smart enough to detect this ploy and you can run into deep trouble if you are trying to utilize this.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Option 1<\/strong><\/p>\n<p>&lt;script type=&#8221;text\/javascript&#8221;&gt;&lt;br&gt;&lt;br&gt;&lt;!&#8211;&lt;br&gt;&lt;br&gt;window.location = &#8220;http:\/\/www.newurl.com\/&#8221;&lt;br&gt;&lt;br&gt;\/\/&#8211;&gt;&lt;br&gt;&lt;br&gt;&lt;\/script&gt;<\/p>\n<p><strong>Option 2 <\/strong><\/p>\n<p>&nbsp;<\/p>\n<p><strong>Once again, JavaScript Redirect is Not Recommended from SEO Perspective.<\/strong><\/p>\n<p><strong>Server Side Redirection<\/strong><\/p>\n<p>&lt;strong&gt;&lt;a name=&#8221;php&#8221;&gt;&lt;\/a&gt;301 Redirection in PHP &lt;\/strong&gt;<\/p>\n<p>The code below should be added at the top of the page.<\/p>\n<p>header(&#8220;HTTP\/1.1 301 Moved Permanently&#8221;);<\/p>\n<p>header(&#8220;Location: http:\/\/www.newurl.com&#8221;);<\/p>\n<p>exit();<\/p>\n<p>&amp;nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong><a name=\"vb\"><\/a>301 Redirection in ASP ( VB Script ) <\/strong><\/p>\n<p>&lt;%@ Language=VBScript %&gt;<\/p>\n<p>&lt;%<\/p>\n<p>Response.Status=&#8221;301 Moved Permanently&#8221;<\/p>\n<p>Response.AddHeader &#8220;Location&#8221;, &#8220;http:\/\/www.newurl.com&#8221;<\/p>\n<p>response.end<\/p>\n<p>%&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><strong><a name=\"jscript\"><\/a>301 Redirection in ASP ( JScript ) <\/strong><\/p>\n<p>The function below is dependent on the default feature of IIS 5 and above, where \u201cResponse.Buffer = true;\u201d is set by default.This should be set before the function is called else it will cause errors.<\/p>\n<p>function PermanentRedirect(strDestinationUri) {<\/p>\n<p>Response.Clear();<\/p>\n<p>Response.Status = 301;<\/p>\n<p>Response.AddHeader(&#8220;Location&#8221;, strDestinationUri);<\/p>\n<p>Response.Flush();<\/p>\n<p>Response.End();<\/p>\n<p>}<\/p>\n<p>&nbsp;<\/p>\n<p>&#8220;strDestinationUri&#8221; should be an absolute URL for maximum client compatibility.<\/p>\n<p>&nbsp;<\/p>\n<p><strong><a name=\"net\"><\/a>301 Redirection in ASP.Net ( C# )<\/strong><\/p>\n<p><script runat=\"server\"><\/p>\n<p>private void Page_Load(object sender, System.EventArgs e)<\/p>\n<p>{<\/p>\n<p>Response.Status = \"301 Moved Permanently\";<\/p>\n<p>Response.AddHeader(\"Location\",\"http:\/\/www.newurl.com\");<\/p>\n<p>}<\/p>\n<p><\/script><\/p>\n<p>&nbsp;<\/p>\n<p><strong><a name=\"cfm\"><\/a>301 Redirection in Cold Fusion ( CFM )<\/strong><\/p>\n<p>&lt;.cfheader statuscode=&#8221;301&#8243; statustext=&#8221;Moved permanently&#8221;&gt;<\/p>\n<p>&lt;.cfheader name=&#8221;Location&#8221; value=&#8221;http:\/\/www.newurl.com&#8221;&gt;<\/p>\n<p>&nbsp;<\/p>\n<p><strong><a name=\"jsp\"><\/a>301 Redirection in JSP \/ JAVA<\/strong><\/p>\n<p>&lt;%<\/p>\n<p>response.setStatus(301);<\/p>\n<p>response.setHeader( &#8220;Location&#8221;, &#8220;http:\/\/www.newurl.com&#8221; );<\/p>\n<p>response.setHeader( &#8220;Connection&#8221;, &#8220;close&#8221; );<\/p>\n<p>%&gt;<\/p>\n<p>&nbsp;<\/p>\n<p>Redirection scripts are extremely important and can be very helpful if applied properly not just for 301 redirection or URL canonicalization issues but also to resolve several situation specific problems. In all cases server level redirections should be the first option and client side redirection should be considered in cases only when you do not have control over your server.<\/p>\n<div>Read more on SEO at <a href=\"http:\/\/seo-kolkata.blogspot.com\/\">SEO Consultant India Blog<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Canonical URLs and issues with URL redirection have been a major concern for most webmasters. While many webmasters have been badly bitten by the canonical URL issue, some others who tried to implement a redirection ( to avoid canonical issues) but couldn&#8217;t implement it properly are often bitten as hard, or even worse. Though Google [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[191,390,233,389,388],"_links":{"self":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/posts\/180"}],"collection":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/comments?post=180"}],"version-history":[{"count":0,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/posts\/180\/revisions"}],"wp:attachment":[{"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/media?parent=180"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/categories?post=180"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/digitalsrc.com\/blog\/wp-json\/wp\/v2\/tags?post=180"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}