« Tutorials / First post / Etc | Main | Automatic 'Print this page' »
March 02, 2005
URL Redirect
If a page on your site has moved, or your whole site for that matter, you will need to redirect your visitors automatically to a new page. Use this meta refresh to send them to the "new" page...
It's done with a "refresh" command using one of the META tags. Here is the piece of code you need to insert in the HEAD of your old page:
< META HTTP-EQUIV="refresh" content="0;URL=http://www.youraddress.edu/yourpage.htm">
Include anything in the BODY of the page if you choose. This is optional... if you choose 0 in the above example, no one will see it anyway. See below for more on this...
The content=" " command does two things. It tells the browser how many seconds to wait before executing the refresh, (the 0 here means zero seconds. If you want to, put in a number like 5 which will give the visitor enough time to read a message.) and then the url you want them to be redirected to.
Watch out for the correct placement of the quotes!. You're used to seeing the quotes around the url, but in this case, the quote marks are around the entire content=" " command, not around the number of seconds or url individually. They are separated by a single semicolon (;).
Of course, you are allowed to write whatever you need in your BODY section. In fact, it's a good idea to put some kind of message like this in case you have a user with an older browser. You should add a manual link to the new page inside the body section of your page:
< META HTTP-EQUIV="refresh" content="5;URL=http://www.youraddress.edu/yourpage.htm">
Then in the BODY tag, a simple text message similar to this:
***
This page has moved. If your browser does not automatically redirect you in a few seconds, click here to go to the new page.
Remember to change your bookmark, so you can find us!
***
As you can see from the example above, This message serves another purpose; it reminds the user to "bookmark" the new address.
One more detail, you might want to consider renaming the page something like:
< TITLE >We've moved!< /TITLE >
Hope this helps!
Posted by kla3 at March 2, 2005 02:06 PM *Posted to Tutorial Category
Trackback Pings
TrackBack URL for this entry:
http://blog.case.edu/test/kevin/mt-tb.cgi/553
Comments
xpuhwjmb lserkgbi wdso xdtof yibrug ocxnwsedy dxvqjpuw
Posted by: lepyogdt larptjbe at February 5, 2007 02:01 AM