<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" ><channel><title>Jamie Le Souef&#187; All posts filed under response status</title> <atom:link href="http://jamielesouef.com/tag/response-status/feed/" rel="self" type="application/rss+xml" /><link>http://jamielesouef.com</link> <description>website . blog . graphic design</description> <lastBuildDate>Sat, 04 Sep 2010 17:48:00 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>301 How to Redirect a Web Page in ASP, ASP.NET or PHP</title><link>http://jamielesouef.com/linux/301-how-to-redirect-a-web-page-in-asp-asp-net-or-php/</link> <comments>http://jamielesouef.com/linux/301-how-to-redirect-a-web-page-in-asp-asp-net-or-php/#comments</comments> <pubDate>Mon, 03 Mar 2008 04:38:03 +0000</pubDate> <dc:creator>Jamie Le Souef</dc:creator> <category><![CDATA[Linux]]></category> <category><![CDATA[Tutorial]]></category> <category><![CDATA[Apache]]></category> <category><![CDATA[ASP]]></category> <category><![CDATA[Code]]></category> <category><![CDATA[com]]></category> <category><![CDATA[domain]]></category> <category><![CDATA[file]]></category> <category><![CDATA[htaccess method]]></category> <category><![CDATA[linux servers]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[redirect]]></category> <category><![CDATA[redirection works]]></category> <category><![CDATA[response status]]></category> <category><![CDATA[search engine rankings]]></category> <category><![CDATA[SEO]]></category> <category><![CDATA[Ubuntu]]></category> <category><![CDATA[Web]]></category><guid isPermaLink="false">http://www.jamielesouef.com/linux/301-how-to-redirect-a-web-page-in-asp-asp.net-or-php/</guid> <description><![CDATA[ 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&#8243; is interpreted as &#8220;moved permanently&#8221;. [...]]]></description> <content:encoded><![CDATA[<div class="tweetmeme_button" style="margin-right: 10px; margin-top:10px; margin-bottom:10px;"> <a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fjamielesouef.com%2Flinux%2F301-how-to-redirect-a-web-page-in-asp-asp-net-or-php%2F"><br /> <img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fjamielesouef.com%2Flinux%2F301-how-to-redirect-a-web-page-in-asp-asp-net-or-php%2F&amp;style=normal" height="61" width="50" /><br /> </a></div><p><a href="http://jamielesouef.com/linux/301-how-to-redirect-a-web-page-in-asp-asp-net-or-php/attachment/164/" rel="attachment wp-att-164" title="50200735006880.jpg"><img src="http://www.jamielesouef.com/wp-content/uploads/50200735006880.thumbnail.jpg" style="margin: 10px; width: 128px; height: 80px" alt="50200735006880.jpg" align="left" height="80" hspace="10" vspace="10" width="128" /></a>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&#8243; is interpreted as &#8220;moved permanently&#8221;.  If  been looking around for the ways on how to do this. So this is what i&#8217;ve found:</p><h3>ASP.NET</h3><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #006600; font-weight: bold;">&lt;</span>script runat<span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;server&quot;</span><span style="color: #006600; font-weight: bold;">&gt;</span>
<span style="color: #990099; font-weight: bold;">private</span> void Page_Load<span style="color: #006600; font-weight:bold;">&#40;</span>object sender, System.<span style="color: #9900cc;">EventArgs</span> e<span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #006600; font-weight:bold;">&#123;</span>
<span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Status</span> <span style="color: #006600; font-weight: bold;">=</span> <span style="color: #cc0000;">&quot;301 Moved Permanently&quot;</span><span style="color: #006600; font-weight: bold;">;</span>
<span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">AddHeader</span><span style="color: #006600; font-weight:bold;">&#40;</span><span style="color: #cc0000;">&quot;Location&quot;</span>,<span style="color: #cc0000;">&quot;http://www.new-url.com&quot;</span><span style="color: #006600; font-weight:bold;">&#41;</span><span style="color: #006600; font-weight: bold;">;</span>
<span style="color: #006600; font-weight:bold;">&#125;</span>
<span style="color: #006600; font-weight: bold;">&lt;/</span>script<span style="color: #006600; font-weight: bold;">&gt;</span></pre></td></tr></table></div><h3>Classic ASP (ASP3.0)</h3><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="asp" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;%</span><span style="color: #006600; font-weight: bold;">@</span> Language<span style="color: #006600; font-weight: bold;">=</span>VBScript<span style="color: #000000; font-weight: bold;">%&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;%</span>
<span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">Status</span><span style="color: #006600; font-weight: bold;">=</span><span style="color: #cc0000;">&quot;301 Moved Permanently&quot;</span>
<span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #330066;">AddHeader</span> <span style="color: #cc0000;">&quot;Location&quot;</span>,<span style="color: #cc0000;">&quot;http://www.new-url.com/&quot;</span>
<span style="color: #990099; font-weight: bold;">Response</span>.<span style="color: #990099; font-weight: bold;">End</span>
<span style="color: #000000; font-weight: bold;">%&gt;</span></pre></td></tr></table></div><h3>PHP Redirect</h3><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #990000;">Header</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;HTTP/1.1 301 Moved Permanently&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">Header</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;Location: http://www.new-url.com&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div><h3>Redirect Old domain to New domain (htaccess redirect)</h3><p class="defaultfont" align="justify">The code belew, which you place into a file called .htaccess in the root folder of your <strong>old </strong>domain, will ensure that all your directories and pages of your old domain will get correctly redirected to your new domain.</p><p class="defaultfont" align="justify">The .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><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">Options +FollowSymLinks
RewriteEngine on
RewriteRule <span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> http:<span style="color: #000000; font-weight: bold;">//</span>www.new-domain-name.com<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">R</span>=<span style="color: #000000;">301</span>,L<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div><p class="defaultfont" align="justify"><strong>NOTE</strong>: REPLACE www.new-domain-name.com in the above code with your actual domain name.</p><p class="defaultfont" align="justify"> <strong>NOTE</strong>: This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.</p><h3>Redirect to www (htaccess redirect)</h3><p class="defaultfont" align="justify"> 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</p><p class="defaultfont" align="justify">As with the last example, the .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><div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">Options +FollowSymlinks
RewriteEngine on
rewritecond <span style="color: #000000; font-weight: bold;">%</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>http_host<span style="color: #7a0874; font-weight: bold;">&#125;</span> ^domain.com <span style="color: #7a0874; font-weight: bold;">&#91;</span>nc<span style="color: #7a0874; font-weight: bold;">&#93;</span>
rewriterule ^<span style="color: #7a0874; font-weight: bold;">&#40;</span>.<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>$ http:<span style="color: #000000; font-weight: bold;">//</span>www.domain.com<span style="color: #000000; font-weight: bold;">/</span>$<span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span><span style="color: #007800;">r</span>=<span style="color: #000000;">301</span>,nc<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></td></tr></table></div><p class="defaultfont" align="justify"><strong>NOTE</strong>: Replace domain.com with your domain name</p><p class="defaultfont" align="justify"> <strong>NOTE</strong>: Both of these last examples ONLY works on Linux servers having the Apache Mod-Rewrite moduled enabled.</p><p class="defaultfont" align="justify"> And there you have it. You can Test your redirection with <a href="http://www.webconfs.com/redirect-check.php">Search Engine Friendly Redirect Checker</a></p> ]]></content:encoded> <wfw:commentRss>http://jamielesouef.com/linux/301-how-to-redirect-a-web-page-in-asp-asp-net-or-php/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching using disk

Served from: jamielesouef.com @ 2010-09-10 04:19:35 -->