March 04, 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: Kevin Adams March 4, 2005 11:48 AM | Category: Tips and Tricks
Trackbacks
Trackback URL for this entry is: URL RedirectPost a comment
Posted by: kla3 (Kevin Adams) March 4, 2005 11:48 AM | Comments (3) | Trackback
http://blog.case.edu/webdev/2005/03/04/url_redirect.html
Office of Marketing and Communications
http://www.case.edu/univrel/marcomm/
http://blog.case.edu/webdev/
216.368.4440



Stumble It!
Comments
Wow! I never knew there was so much great information out there.
Love what you did with this place. Keep up the awesome job. It's waycool.
Have a good one!
Victor
Thats such a simple piece of code. I have moved pages regularly, but have not implemented anything like above, but gonna try it.
Kevin, this is a cool approach but my favorite for linux hosted sites is the 301 redirect in the .htaccess file saved in the root directory of your site.
redirect 301 (the instruction that the page has moved)
/old/old.htm (the original folder path and file name)
http://www.you.com/new.htm (new path and file name)
Please check out our site:
JDHL Technologies - seo experts
SEO Blog - Tips and Techniques
Regards, Jared Blake