{"id":374,"date":"2010-04-13T09:37:47","date_gmt":"2010-04-13T13:37:47","guid":{"rendered":"http:\/\/www.eyoungwon.com\/journal\/?p=374"},"modified":"2010-04-13T09:37:47","modified_gmt":"2010-04-13T13:37:47","slug":"301-page-redirects","status":"publish","type":"post","link":"https:\/\/eyoungwon.com\/journal\/301-page-redirects\/","title":{"rendered":"301 Page Redirects"},"content":{"rendered":"<p>301 redirect is the most efficient and <strong>Search Engine Friendly<\/strong> method for webpage redirection. It&#8217;s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it&#8217;s the safest option. The code &#8220;301&#8221; is interpreted as &#8220;moved permanently&#8221;.<\/p>\n<p>Below are a Couple of methods to implement <strong>URL Redirection<\/strong><\/p>\n<h2>IIS Redirect<\/h2>\n<ul>\n<li>In internet services manager, right click on the file or folder you wish to redirect<\/li>\n<li>Select the radio titled &#8220;a redirection to a URL&#8221;.<\/li>\n<li>Enter the redirection page<\/li>\n<li>Check &#8220;The exact url entered above&#8221; and the &#8220;A permanent redirection for this resource&#8221;<\/li>\n<li>Click on &#8216;Apply&#8217;<\/li>\n<\/ul>\n<h2>ColdFusion Redirect<\/h2>\n<p><span>&lt;.cfheader statuscode=&#8221;301&#8243; statustext=&#8221;Moved permanently&#8221;&gt;<br \/>\n&lt;.cfheader name=&#8221;Location&#8221; value=&#8221;http:\/\/www.new-url.com&#8221;&gt; <\/span><\/p>\n<h2>PHP Redirect<\/h2>\n<p><span>&lt;?<br \/>\nHeader( &#8220;HTTP\/1.1 301 Moved Permanently&#8221; );<br \/>\nHeader( &#8220;Location: http:\/\/www.new-url.com&#8221; );<br \/>\n?&gt; <\/span><\/p>\n<h2>ASP Redirect<\/h2>\n<p><span>&lt;%@ Language=VBScript %&gt;<br \/>\n&lt;%<br \/>\nResponse.Status=&#8221;301 Moved Permanently&#8221;<br \/>\nResponse.AddHeader &#8220;Location&#8221;,&#8221;http:\/\/www.new-url.com\/&#8221;<br \/>\n%&gt; <\/span><\/p>\n<h2>ASP .NET Redirect<\/h2>\n<p><span>&lt;script runat=&#8221;server&#8221;&gt;<br \/>\nprivate void Page_Load(object sender, System.EventArgs e)<br \/>\n{<br \/>\nResponse.Status = &#8220;301 Moved Permanently&#8221;;<br \/>\nResponse.AddHeader(&#8220;Location&#8221;,&#8221;http:\/\/www.new-url.com&#8221;);<br \/>\n}<br \/>\n&lt;\/script&gt; <\/span><\/p>\n<h2>JSP (Java) Redirect<\/h2>\n<p><span>&lt;%<br \/>\nresponse.setStatus(301);<br \/>\nresponse.setHeader( &#8220;Location&#8221;, &#8220;http:\/\/www.new-url.com\/&#8221; );<br \/>\nresponse.setHeader( &#8220;Connection&#8221;, &#8220;close&#8221; );<br \/>\n%&gt; <\/span><\/p>\n<h2>CGI PERL Redirect<\/h2>\n<p><span>$q = new CGI;<br \/>\nprint $q-&gt;redirect(&#8220;http:\/\/www.new-url.com\/&#8221;); <\/span><\/p>\n<h2>Ruby on Rails Redirect<\/h2>\n<p><span>def old_action<br \/>\nheaders[&#8220;Status&#8221;] = &#8220;301 Moved Permanently&#8221;<br \/>\nredirect_to &#8220;http:\/\/www.new-url.com\/&#8221;<br \/>\nend <\/span><\/p>\n<h2>Redirect Old domain to New domain (htaccess redirect)<\/h2>\n<p>Create a .htaccess file with the below code, it will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.<br \/>\nThe .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)<\/p>\n<p>Options +FollowSymLinks<br \/>\nRewriteEngine on<br \/>\nRewriteRule (.*) http:\/\/www.newdomain.com\/$1 [R=301,L]<\/p>\n<p>Please REPLACE www.newdomain.com in the above code with your actual domain name.<\/p>\n<p>In addition to the redirect I would suggest that you contact every backlinking site to modify their backlink to point to your new website.<\/p>\n<p><strong>Note*<\/strong> This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.<\/p>\n<h2>Redirect to www (htaccess redirect)<\/h2>\n<p>Create a .htaccess file with the below code, it will ensure that all requests coming in to domain.com will get redirected to www.domain.com<br \/>\nThe .htaccess file needs to be placed in the root directory of your old website (i.e the same directory where your index file is placed)<\/p>\n<p>Options +FollowSymlinks<br \/>\nRewriteEngine on<br \/>\nrewritecond %{http_host} ^domain.com [nc]<br \/>\nrewriterule ^(.*)$ http:\/\/www.domain.com\/$1 [r=301,nc]<\/p>\n<p>Please REPLACE domain.com and www.newdomain.com with your actual domain name.<\/p>\n<p><strong>Note*<\/strong> This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.<\/p>\n<h2>How to Redirect HTML<\/h2>\n<p>Please refer to section titled &#8216;How to Redirect with htaccess&#8217;, if your site is hosted on a Linux Server and &#8216;IIS Redirect&#8217;, if your site is hosted on a Windows Server.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>301 redirect is the most efficient and Search Engine Friendly method for webpage redirection. It&#8217;s not that hard to implement and it should preserve your search engine rankings for that particular page. If you have to change file names or move pages around, it&#8217;s the safest option. The code &#8220;301&#8221; is interpreted as &#8220;moved permanently&#8221;. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[34,2,39],"tags":[164,166,171,168,165,169,170,167,172],"class_list":["post-374","post","type-post","status-publish","format-standard","hentry","category-computersnetworks","category-web-development","category-web-hosting","tag-301-redirect","tag-asp-redirect","tag-asp-net-redirection","tag-cgi-redirect","tag-iis-redirect","tag-jsp-redirect","tag-page-redirection","tag-php-redirect","tag-web-page-redirection"],"_links":{"self":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/374","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/comments?post=374"}],"version-history":[{"count":2,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/374\/revisions"}],"predecessor-version":[{"id":376,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/posts\/374\/revisions\/376"}],"wp:attachment":[{"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/media?parent=374"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/categories?post=374"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/eyoungwon.com\/journal\/wp-json\/wp\/v2\/tags?post=374"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}