301 Redirect on page code

301 Redirect

301 redirection and the Search Engines. It’s really not that hard to implement and it should help your search engine rankings when move sites or pages that where listed in the search engine

The Search Engines see the “301″ Has “moved permanently”.


301 Redirect in ColdFusion
<.cfheader statuscode=”301″ statustext=”Moved permanently”>
<.cfheader name=”Location” value=”http://www.new-site.com”>


301 Redirect in PHP
<?php
Header( “HTTP/1.1 301 Moved Permanently” );
Header( “Location: http://www.new-site.com” );
?>


301 Redirect in ASP
<%@ Language=VBScript %>
<%
Response.Status=”301 Moved Permanently”
Response.AddHeader “Location”, ” http://www.new-site.com”
>


301 Redirect in ASP .NET
<script runat=”server”>
private void Page_Load(object sender, System.EventArgs e)
{
Response.Status = “301 Moved Permanently”;
Response.AddHeader(”Location”,”http://www.new-site.com”);
}
</script>

hope thats helps

DaveN

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • Live
  • StumbleUpon
  • Facebook
  • Google
  • Reddit
  • Technorati
  • Mixx

9 Comments | Leave a comment »

  1. 1. Ugly Dog | December 23rd 2005 @ 3:23 pm

    I have a Yahoo store, I assume that this means that I can’t do a 301 redirect with Yahoo? Those Bastards..

    Can I run my own executables on Yahoo! Web Hosting?
    No, Yahoo! Web Hosting does not allow you to run your own executable files on our servers. You can, of course, execute your PHP scripts. You do not need to change permissions on your scripts to make them executable: They’re recognized as PHP scripts by the file extension .php.

  2. 2. Jaan Kanellis | December 24th 2005 @ 1:46 am
  3. 3. claus | December 28th 2005 @ 3:55 pm

    Nice one Dave :)

    Especially the ASP and ASP-dot-net ones are frequently sought after.

    Anyway, the reason I’m dropping this line is to add that you specifically shouldn’t just use a “response.redirect” in ASP. I hear that it’s pretty common, but unfortunately it returns a 302 and not a 301.

    Oh, and McAnerin got the Perl flavour as well.

  4. 4. Bidera | January 2nd 2006 @ 12:05 pm

    Good basic info there. Some people still do use Perl, you know. :)
    /found this through threadwatch

  5. 5. Rob | January 5th 2006 @ 4:30 pm

    For Perl you just put this before your \r\n\r\n

    Location: http://www.domain.com/redirect/to/this/page.html

  6. for .htaccess they wrote nothing? :(

  7. 7. earnest | June 14th 2007 @ 5:30 pm
  8. 8. Wilhelm912 | July 20th 2008 @ 4:50 am

    So currently I have my website built on asp. I’m confused whether it is possible to redirect a few of my asp pages to my new Yahoo store.

  9. 9. SNVC | August 17th 2008 @ 4:24 pm

    This is definitely a good guide. Thanks for this.

Leave a Reply

required

required, hidden

+ Advertise Here