Forum Moderators: coopster

Message Too Old, No Replies

header(location) and Search Engines

         

Pico_Train

3:12 pm on Apr 24, 2008 (gmt 0)

10+ Year Member




This is a php/search engine question...

Is the following a bit suspect to search engines or not?

header("Location:http://".$_SERVER['HTTP_HOST']."/restaurant/town/".$town);

Is it a funny redirect or not is my question?

PHP_Chimp

9:20 am on Apr 25, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the header(Location: call sends a 302 redirect. So for search engines you usually want a 301 redirect.
void header ( string $string [, bool $replace [, int $http_response_code ]] )

So from the user comments [us.php.net]in the manual -
<?php
// 301 Moved Permanently
header("Location: /foo.php",TRUE,301);

// 302 Found
header("Location: /foo.php",TRUE,302);
header("Location: /foo.php");

// 303 See Other
header("Location: /foo.php",TRUE,303);

// 307 Temporary Redirect
header("Location: /foo.php",TRUE,307);
?>