Don’t use Meta Redirect! by Lloyd Armbrust
Okay, sometimes you need to move (redirect) an HTML page. It happens to everyone! But really want to never ever never Meta Redirects. In fact, the W3C has pronounced it in their top ten mistakes of new web design: http://www.w3.org/QA/Tips/reback
If you can’t or won’t make an .htaccess redirect, perhaps you can use another language at your disposal.
For example:
ColdFusion Redirect:
<.cfheader statuscode="301" statustext="Moved permanently"> <.cfheader name="Location" value="http://www.new-url.com">
PHP Redirect:
Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url.com" );
ASP Redirect:
<%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location","http://www.new-url.com/" %>
JSP (Java) Redirect:
<% response.setStatus(301); response.setHeader( "Location", "http://www.new-url.com/" ); response.setHeader( "Connection", "close" ); %>
CGI PERL Redirect:
$q = new CGI;
print $q->redirect("http://www.new-url.com/");
Ruby on Rails Redirect:
def old_action headers["Status"] = "301 Moved Permanently" redirect_to "http://www.new-url.com/" end
And if you have CPanel, Plesk, or some other web-based domain-management system they probably have a way for you to tap directly into Apache and make that change in a nice GUI.
If some inexplicatble reason you are compelled to use Meta Redirects, please use the techniques found here so that Google and your browser can make sense of what’s going on:
http://itscalledwebdesign.com/meta-redirect/
Some external links:
http://www.webconfs.com/how-to-redirect-a-webpage.php
http://en.wikipedia.org/wiki/URL_redirection
October 3rd, 2008 at 2:56 pm
what would you do, then if you wanted a single html file to redirect somewhere else, but not the entire directory?
April 27th, 2009 at 10:03 pm
Except that you can’t set cookies on a 302 – you must use metarefresh
December 29th, 2009 at 2:51 pm
http://itscalledwebdesign.com/meta-redirect/ goes to a 404.
If some inexplicatble reason you are compelled to use Meta Redirects, please use the techniques found here so that Google and your browser can make sense of what’s going on:
http://itscalledwebdesign.com/meta-redirect/
CLASSIC!
Good info tho. Thank you.