Browser 301 Redirects In All Languages

. 5/25/10
  • Agregar a Technorati
  • Agregar a Del.icio.us
  • Agregar a DiggIt!
  • Agregar a Yahoo!
  • Agregar a Google
  • Agregar a Meneame
  • Agregar a Furl
  • Agregar a Reddit
  • Agregar a Magnolia
  • Agregar a Blinklist
  • Agregar a Blogmarks

Browser redirects, especially 301 “permanent” redirects, are essential to all good web applications. Regardless of language, browser redirects can:
  • provide safe URL forwarding to gather GET and POST variables and process them without risking data and processing integrity by a browser refresh
  • send users and search engine bots to the new location of a page or entire website
  • maintain search engine rank and avoid 404 errors
Here’s the list of browser redirects using various languages:
.htaccess
redirect 301 / http://www.nucus.com/funzone/

ASP
Response.Status="301 Moved Permanently";
Response.AddHeader("Location","http://www.nucus.com/funzone/");

ASP.NET
%MINIFYHTML566a242aafa52a81ebecb4ab65d263f47% 

ColdFusion
<CFHEADER statuscode="301" statustext="Moved Permanently">
<CFHEADERname="Location" value="http://www.nucus.com/funzone/">

Javascript (NOT a 301)
//window.location.href = 'http://www.nucus.com/funzone/';

Java JSP
response.setStatus(301);
response.setHeader("Location", "http://www.nucus.com/funzone/");
response.setHeader("Connection", "close");

Meta tag (NOT a 301)
<meta http-equiv="refresh" content="0;url=http://www.nucus.com/funzone/" />

Perl
use strict;
print "Status: 301 Moved Permanantlyn";
print "Location: http://www.nucus.com/funzone/";
exit;

PHP
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.nucus.com/funzone/');

Ruby On Rails
def old_action
headers["Status"] = "301 Moved Permanently"
redirect_to "http://www.nucus.com/funzone/"
end

0 comments: