Digital Marketing Handbook

(ff) #1

301 redirect 174





  • This technique is usable by all web authors because the meta tag is contained inside the document itself.

  • • The meta tag must be placed in the "head" section of the HTML file.

  • • The number "0" in this example may be replaced by another number to achieve a delay of that many seconds.

  • • This is a proprietary extension to HTML introduced by Netscape but supported by most web browsers. The
    manual link in the "body" section is for users whose browsers do not support this feature.
    This is an example of achieving the same effect by issuing an HTTP refresh header:


HTTP/1.1 200 ok


Refresh: 0; url=http://www.example.com/


Content-type: text/html


Content-length: 78


Please follow this link!


This response is easier to generate by CGI programs because one does not need to change the default status code.
Here is a simple CGI program that effects this redirect:

#!/usr/bin/perl


print "Refresh: 0; url=http://www.example.com/\r\n";


print "Content-type: text/html\r\n";


print "\r\n";


print "Please follow <a href=\"http://www.example.com/\">this link!"


Note: Usually, the HTTP server adds the status line and the Content-length header automatically.
This method is considered by the W3C to be a poor method of redirection, since it does not communicate any
information about either the original or new resource, to the browser (or search engine). The W3C's Web Content
Accessibility Guidelines (7.4) [16] discourage the creation of auto-refreshing pages, since most web browsers do not
allow the user to disable or control the refresh rate. Some articles that they have written on the issue include W3C
Web Content Accessibility Guidelines (1.0): Ensure user control of time-sensitive content changes [17] and Use
standard redirects: don't break the back button! [18]
Free download pdf