Use standard redirects: don't break the back button!
Techniques to use and techniques to avoid
Don't use "refresh" to redirect
If you want http://www.example.org/foo to actually display what's at http://www.example.org/bar you should not use "refresh" techniques like :
<META HTTP-EQUIV=REFRESH CONTENT="1; URL=http://www.example.org/bar">.
Why? because it could break the "back" button. Imagine that the user presses the "back" button, the refresh would work again, and the user would bounce forward. The user will most likely get very annoyed, and close the window, which is probably not what you, as the author of this page, want.
Use HTTP redirects instead
When using the "refresh" meta-tag to create a redirection, what we have is a specific instruction within the document. The User Agent (be it a browser or the Markup Validator) is expected to download the page, look at its contents, find the "refresh" instruction, wait the specified amount of time (which could just happen to be "0" seconds for an "immediate" refresh, but really could be anything), and then proceed to the new address.
A "HTTP Redirect" on the other hand acts much more directly because it is done within another layer. When the User Agent (i.e. a browser or the validator) first contacts the server and requests the document, the _server_ itself, having been configured to redirect the document to another address, replies to the user-agent that it should instead look at the new address.
A "HTTP Redirect" is also a richer way to redirect because it gives the User Agent more information than just the new address: the server also gives some information about the purpose and type of redirection, which allows the User Agent to behave differently depending on the type of redirect. The different types of HTTP redirects (based on the HTTP status code in the response sent by the server) are the Permanent Redirect (HTTP 301), the Temporary Redirect (307), and the undefined redirect (302).
See the links below for documentation and tutorials on how to do it with your web server.
- About redirects :
- The Top Ten New Mistakes of Web Design, by Jakob Nielsen, offers a view of why refresh should not be used for redirecting a document to a new address, as well as other (do's and) don't's on web design.
- The section 10.3 Redirection 3xx in Hypertext Transfer Protocol -- HTTP/1.1, is the authoritative documentation on HTTP redirects.
- How to do redirects with your server:
About the "QA Tips"
The W3C QA Tips are short documents explaining useful bits of knowledge for Web developers or designers, hosted and produced by the Quality Assurance Interest Group at W3C.
While the tips are carefully reviewed by the participants of the group, they should not be seen as anything else than informative bits of wisdom, and especially, they are not normative W3C technical specifications.
Learn more about the Tips, how to submit your own pearls of wisdom, and find all the other QA tips in the Tips Index.