301 Redirect Codes For PHP, ASP, Coldfusion, and More

301 is an HTTP status code that basically instructs search engines and browsers that a page has moved, permanently. If you’ve changed a file name, domain, folder path, whatever, a 301 redirect will update the search engines. This ensures your content remains indexed and available via search engines.

PHP 301 Redirect Code <?php Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url-here.com" ); ?>

ASP 301 Redirect Code <%@ Language=VBScript %> <% Response.Status="301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url-here.com/"); %>

ASP.net 301 Redirect Code <script runat="server"%> private void Page_Load(object sender, System.EventArgs e) { Response.Status = "301 Moved Permanently"; Response.AddHeader("Location","http://www.new-url-here.com"); } </script>

Coldfusion 301 Redirect Code <cfheader statuscode="301" statustext="Moved permanently"> <cfheader name="Location" value="http://www.new-url-here.com">

Perl 301 Redirect Code #!/usr/bin/perl -w use strict; print "Status: 301 Moved Permanantly\n"; print "Location: http://www.new-url-here.com/page.htm\n\n"; exit;

In addition, javascript, meta refresh tags, and some web-servers even support redirection management via conf files. If there’s a particular redirect you’d like to know more about but can’t seem to find any information, post a comment and I’ll do my best to provide some guidance.

Additional Posts Worth Reading

 

Comments »

No comments yet.

Name (required)


E-mail (required - never shown publicly)


URI - Web Site Address






Subscribe

Site of The Day

Sponsors

Categories

Recent Comments

  • Arthur: I can’t even be an Ebay affiliate. Tried various ways but still declined. Any help or suggestions?
  • chicago web design: I can’t imagine that these will last very long before Google banishes them all. But for now...
  • D.Ksyte: Anyone involved with cron job scheduling might find this resource useful. Cron Sandbox at HxPI is an...
  • FoNiX: “…decode md5″ is not possible, only bruteforce: generate hash and compare with original.
  • Z@$#: plz plz decript this hash for me any one….its really important…. 2CAD28C7C619F27DDE7B83C4999795BA
  • Joe: Thanks for writing this up. I tried the second method…however after the debian install the screen looks...
  • Scott: Was this issue ever resolved? I just started having a problem a couple weeks ago. I don’t do any kind of...
  • Prashant Patel: I had integrated Sp3 in Xp But finding one problem. In the Task Manager Process windows many services...
  • Ed: This looks like a real ‘leet’ linux command but it misses the point. Why would a hacker keep the name of...
  • Sudesh: My account was disabled but I followed their guideline and in one sec it was back on :) Here is the...

Top Commentators

Miscellaneous

  • Add to Technorati Favorites