{"id":8,"date":"2009-08-20T06:08:26","date_gmt":"2009-08-20T06:08:26","guid":{"rendered":"http:\/\/samwebman.wordpress.com\/?p=4"},"modified":"2009-08-20T06:08:26","modified_gmt":"2009-08-20T06:08:26","slug":"permanent-redirect-with-http-301","status":"publish","type":"post","link":"https:\/\/www.intentrust.com\/?p=8","title":{"rendered":"Permanent Redirect with HTTP 301"},"content":{"rendered":"<p><a href=\"http:\/\/samwebman.files.wordpress.com\/2009\/08\/redirect.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-9\" title=\"redirect\" src=\"http:\/\/samwebman.files.wordpress.com\/2009\/08\/redirect.jpg\" alt=\"redirect\" width=\"600\" height=\"376\" \/><\/a><\/p>\n<p><strong>HTTP 301 Redirect in <\/strong>ASP.NET<\/p>\n<p>&lt;script  runat=&#8221;server&#8221;&gt;<\/p>\n<p>private void  Page_Load(object sender, System.EventArgs e)<\/p>\n<p>{<\/p>\n<p>Response.Status = &#8220;301  Moved Permanently&#8221;;<\/p>\n<p>Response.AddHeader(&#8220;Location&#8221;,&#8221;http:\/\/www.new-url.com\/&#8221;);<\/p>\n<p>}&lt;\/script&gt;<\/p>\n<p><strong>HTTP 301 Redirect in ASP-VBScript<\/strong><br \/>\n&lt;%@ Language=VBScript %&gt;<br \/>\n&lt;% Response.Status = &#8220;301 Moved Permanently&#8221;<br \/>\nResponse.AddHeader &#8220;Location&#8221;, &#8220;http:\/\/www.somacon.com\/&#8221;<br \/>\nResponse.End<br \/>\n%&gt;<\/p>\n<p><strong>HTTP 301 Redirect in PHP<\/strong><br \/>\n&lt;?php header(&#8220;HTTP\/1.1 301 Moved Permanently&#8221;);<br \/>\nheader(&#8220;Location: http:\/\/www.somacon.com\/&#8221;); exit(); ?&gt;<\/p>\n<p><strong>HTTP 301 Redirect in ColdFusion<\/strong><br \/>\n&lt;CFHEADER statuscode=&#8221;301&#8243; statustext=&#8221;Moved Permanently&#8221;&gt;<br \/>\n&lt;CFHEADER name=&#8221;Location&#8221; value=&#8221;http:\/\/www.somacon.com\/&#8221;&gt;<\/p>\n<p><strong>HTTP 301 Redirect in Perl<\/strong><br \/>\n#!\/usr\/bin\/perl\u00a0\u00a0\u00a0\u00a0\u00a0 -w<br \/>\nuse strict;<br \/>\nprint &#8220;Status: 301 Moved Permanently\\n&#8221;;<br \/>\nprint &#8220;Location: http:\/\/somewhere\/page.htm\\n\\n&#8221;;<br \/>\nexit;<\/p>\n<p><strong>Redirection with Javascript<\/strong><br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br \/>\nwindow.location.href=&#8217;http:\/\/www.somacon.com\/&#8217;;<br \/>\n&lt;\/script&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;This page has moved to &lt;a href=&#8221;http:\/\/somacon.com\/&#8221;&gt;http:\/\/somacon.com\/&lt;\/a&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p><em>Note that they syntax document.location=&#8221;; has been deprecated. Use the above code, or alternately, document.URL=&#8221;;.<\/em><\/p>\n<p><strong>Redirection with META Refresh<\/strong><br \/>\n&lt;html&gt;<br \/>\n&lt;head&gt;<br \/>\n&lt;meta http-equiv=&#8221;refresh&#8221; content=&#8221;0;url=http:\/\/www.somacon.com\/&#8221;&gt;<br \/>\n&lt;\/head&gt;<br \/>\n&lt;body&gt;<br \/>\nThis page has moved to &lt;a href=&#8221;http:\/\/somacon.com\/&#8221;&gt;http:\/\/somacon.com\/&lt;\/a&gt;<br \/>\n&lt;\/body&gt;<br \/>\n&lt;\/html&gt;<\/p>\n<p>Reference from: <a href=\"http:\/\/www.somacon.com\/p145.php\" target=\"_blank\" rel=\"noopener\">http:\/\/www.somacon.com\/p145.php<\/a>; <a href=\"http:\/\/www.w3.org\/Protocols\/rfc2616\/rfc2616-sec10.html\" target=\"_blank\" rel=\"noopener\">Http\/1.1 code definitions<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>HTTP 301 Redirect in ASP.NET &lt;script runat=&#8221;se &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.intentrust.com\/?p=8\" class=\"more-link\">\u95b1\u8b80\u5168\u6587<span class=\"screen-reader-text\">\u3008Permanent Redirect with HTTP 301\u3009<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[7,16],"tags":[],"_links":{"self":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/posts\/8"}],"collection":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8"}],"version-history":[{"count":0,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=\/wp\/v2\/posts\/8\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.intentrust.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}