...

View Full Version : 301 Redirect using PHP



johnnyb
08-22-2007, 06:36 PM
Hi,

Is it possible to do a 301 redirect using PHP, perhaps by outputting a header or something? I would prefer to do it with .htaccess, (see this thread: http://www.codingforums.com/showthread.php?t=121851 ), but I can't figure out how to make it work, and I'm not really getting any action on that other thread.

So, if anyone knows how to either a) do what I want to in the linked thread or b) accomplish a 301 redirect with PHP I would love to know how.

John

rafiki
08-22-2007, 07:39 PM
google search?

Pennimus
08-22-2007, 11:00 PM
http://www.php.net/header

Inigoesdr
08-22-2007, 11:09 PM
header('HTTP/1.1 301 Moved Permanently');
header('Location: http://www.yoursite.com/');
exit;

johnnyb
08-23-2007, 05:38 PM
Thanks so much. I've got it running now!

I ran into one example that also issued a Status header, I'm not sure what it does, but I figure if I can have 2 things that say "301" it's better than 1 ;)

John



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum