Lost Password?


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

PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-28-2006, 09:30 PM
Dan Dan is offline
Programmer
 
Join Date: Jun 2006
Posts: 145
Rep Power: 9
Dan is on a distinguished road
Default The Ultimate PHP 301 direct/forwarding thread!

If you don't know what a PHP 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".

Code:
<?
Header( "HTTP/1.1 301 Moved Permanently" ); 
Header( "Location: http://www.new-url.com" ); 
?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 06-29-2006, 11:26 AM
Lop's Avatar   
Lop Lop is offline
Speaks fluent binary
 
Join Date: May 2006
Posts: 1,149
Rep Power: 18
Lop will become famous soon enoughLop will become famous soon enough
Default

I use just the bottom line to forward.

PHP Code:
<?php
Header
"Location: http://www.new-url.com" );
?>
I suppose I should add the 301 line.
__________________
Lop
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-29-2006, 08:52 PM
sarahk's Avatar   
sarahk sarahk is offline
Newbie
 
Join Date: Jun 2006
Location: Auckland, New Zealand
Posts: 18
Rep Power: 9
sarahk is on a distinguished road
Default

Yes you should. Otherwise the server doesn't know why the forward is there. 301s are important so you should take the time to add the extra line.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-05-2006, 10:56 PM
Kaabi's Avatar   
Kaabi Kaabi is offline
Programming God
 
Join Date: Jul 2006
Posts: 884
Rep Power: 14
Kaabi is on a distinguished road
Default

The PHP redirect is so simple, the "ultimate" makes it sound intricate. It's so funny Dan, you've made a lot of "Ultimate 301 redirect" threads, and it's not even that special a function. You make me laugh (in a good way).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 07-06-2006, 02:49 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 Kaabi
The PHP redirect is so simple, the "ultimate" makes it sound intricate. It's so funny Dan, you've made a lot of "Ultimate 301 redirect" threads, and it's not even that special a function. You make me laugh (in a good way).
I have added them for every language rather than just post one thread in the "general" forum - I think this will make it easier, and more useful for peple who visit the site.

I just used the word "ultimate" as it is the only thread you will need to learn how to do a 301 redirect in that particular language
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #6 (permalink)  
Old 07-06-2006, 12:36 PM
Fredto Fredto is offline
Newbie
 
Join Date: Jul 2006
Posts: 16
Rep Power: 9
Fredto is on a distinguished road
Default

I use a .htaccess for my redirections.

It's simple to use and I have to edit only one file for an entire folder
__________________
Remember, pillage first then burn.
Random stuff - My blog.
SciFanTalk.com - Sci-Fi and Fantasy fans are welcome.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 07-08-2006, 04:16 PM
Kaabi's Avatar   
Kaabi Kaabi is offline
Programming God
 
Join Date: Jul 2006
Posts: 884
Rep Power: 14
Kaabi is on a distinguished road
Default

Makes sense, and ultimate is an attractive word. Fredto, does an .htaccess redirect preserve search engine rankings? That's a very important thing that a redirect should do.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



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
The Ultimate ASP/ASP.net 301 direct/forwarding thread! Dan ASP, ASP.NET and Coldfusion 3 01-08-2007 03:33 PM
The Ultimate Codefusion 301 direct/forwarding thread! Dan ASP, ASP.NET and Coldfusion 0 06-28-2006 09:28 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 04:13 PM.

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: 98%

Ads