CASE.EDU:    HOME | DIRECTORIES | SEARCH

The Web Development Blog has moved to http://www.heidicool.com/blog/. Please visit me there to read the latest entries and to update your bookmarks and RSS feeds.

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!

StumbleUpon Toolbar Stumble It! AddThis Social Bookmark Button


Posted by: Kevin Adams March 4, 2005 11:48 AM | Category: Tips and Tricks

Trackbacks

Trackback URL for this entry is: URL Redirect

Comments

gravatar

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

Posted by VictorDehamond on January 21, 2007 05:18 AM

gravatar

Thats such a simple piece of code. I have moved pages regularly, but have not implemented anything like above, but gonna try it.

Posted by web design on June 26, 2007 03:41 PM

gravatar

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

Posted by Jared Blake on July 31, 2007 02:08 AM

Post a comment

















Posted by: kla3 (Kevin Adams) March 4, 2005 11:48 AM | Comments (3) | Trackback