Lost Password?


Go Back   CodeCall Programming Forum > Web Development Forum > HTML Programming

HTML Programming Forum discussion covering HTML, XHTML, DHTML and all flavors of HTML. Hypertext Markup Language is used to create websites.

Closed Thread
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-28-2006, 08:58 PM
Dan Dan is offline
Programmer
 
Join Date: Jun 2006
Posts: 145
Rep Power: 9
Dan is on a distinguished road
Default The ultimate xHTML / DHTML / HTML 301 redirection thread!

If you don't know what a HTML/xHTML/DHTML 301 redirect is, you will by the end of this thread! If you need to redirect a page, unfortunately it isn't as simple as using one of the various methods - only the 301 redirect will preserve search engine rankings for the page. It is the most efficient, search engine friendly method for website redirection - the code 301 is interpreted as "moved permanently".

Here is how to perform a 301 redirect in the 3 afformentioned coding languages:

HTML, xHTML, DHTML:
  1. Create a .htaccess file by opening up notepad, or a similair text/txt editor and save the file as .htaccess with no extension.
  2. Place this code in your .htaccess file:

    Code:
    redirect 301 /old/old.htm http://www.yoursite.com/new.htm
    OR, if you are redirecting to a new url, you need the following code:

    Code:
    redirect 301 / http://www.yoursite.com/new.htm
    If you already have one of these files - make sure you leave a line before adding the code!

  3. Save the file and upload to your server root folder.


  4. Test the redirect works by visiting the old page - you should automatically be redirected!

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!

Sponsored Links
  #2 (permalink)  
Old 07-04-2006, 09:58 AM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 11
brackett is on a distinguished road
Default

Actually, that's webserver dependent. The .htaccess trick is Apache only. IIS can do similar, but you need to use the IIS manager and set it...I don't recall the specifics right now, but basically right click the website/folder/file and there's a redirect tab I think.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3 (permalink)  
Old 07-04-2006, 10:17 AM
Dan Dan is offline
Programmer
 
Join Date: Jun 2006
Posts: 145
Rep Power: 9
Dan is on a distinguished road
Default

Quote:
Originally Posted by brackett
Actually, that's webserver dependent. The .htaccess trick is Apache only. IIS can do similar, but you need to use the IIS manager and set it...I don't recall the specifics right now, but basically right click the website/folder/file and there's a redirect tab I think.
Apologies yes, I should have stipulated that this would only work on Apache.

See the asp thread for IIS, I don't have much experience of windows servers so wouldn't know the trick above - is it a 301 redirect?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4 (permalink)  
Old 07-04-2006, 02:25 PM
DevilsCharm's Avatar   
DevilsCharm DevilsCharm is offline
Programming God
 
Join Date: Jul 2006
Posts: 887
Rep Power: 14
DevilsCharm is on a distinguished road
Default

301 redirects are useful, but isn't there another way to do a redirect that isn't called a 301 redirect? I think there is another way, or maybe I'm just thinking of something else.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #5 (permalink)  
Old 07-04-2006, 06:18 PM
Dan Dan is offline
Programmer
 
Join Date: Jun 2006
Posts: 145
Rep Power: 9
Dan is on a distinguished road
Default

Quote:
Originally Posted by DevilsCharm
301 redirects are useful, but isn't there another way to do a redirect that isn't called a 301 redirect? I think there is another way, or maybe I'm just thinking of something else.
There are plenty of other ways of doing it through javascript etc.

However, only a 301 redirect should be used as this is the best for search engine optimisation. A 301 redirect is favoured by the search engines and wont lose existing pagerank.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!

Sponsored Links
  #6 (permalink)  
Old 07-04-2006, 06:57 PM
brackett brackett is offline
Programmer
 
Join Date: May 2006
Posts: 193
Rep Power: 11
brackett is on a distinguished road
Default

Quote:
Originally Posted by Dan
Apologies yes, I should have stipulated that this would only work on Apache.

See the asp thread for IIS, I don't have much experience of windows servers so wouldn't know the trick above - is it a 301 redirect?
Yes, IIS can generate both 301 (permanent) or 302 (temporary) redirects. http://support.microsoft.com/default...313074&sd=tech
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
About HTML Onur Tutorials 0 08-28-2007 07:13 PM
HTML Introduction clookid Tutorials 5 01-08-2007 10:43 PM
The Ultimate ASP/ASP.net 301 direct/forwarding thread! Dan ASP, ASP.NET and Coldfusion 3 01-08-2007 03:33 PM
What is HTML, DHTML and XHTML? Lop HTML Programming 5 08-09-2006 12:00 PM
The Ultimate HTML/xHTML/DHTML 301 direct/forwarding thread! Dan HTML Programming 0 06-28-2006 08:58 PM


All times are GMT -5. The time now is 07:31 AM.

Contest Stats

WingedPanther ........ 2753.6
Xav ........ 2704
Brandon W ........ 1702.32
John ........ 1207.73
marwex89 ........ 1175.24
morefood2001 ........ 966.05
dcs ........ 655.75
Steve.L ........ 475.59
orjan ........ 418.58
Aereshaa ........ 383.54

Contest Rules

CodeCall Goal

Goal: 100,000 Posts
Complete: 100%


Complete - Celebrate!

Ads