I have this code below I guess you can work out what i'm trying to do basically I'm trying to add a value to a URL before it redirects. <?php $id = $_GET['id']; header("Location:"http://www.example.com/'.$id'/"); exit; ?> PHP: I'm not sure if I'm on the right track or not? +rep for any help!
right idea... I made a post about this here: 301 Redirect That should pretty much point you in the right direction.
Yes, you're on the right track. Something like this should work: <?php $id = $_GET['id']; header("Location: http://www.example.com/" . $id . "/"); exit; ?> PHP: Actually I think header("Location: http://www.example.com/$id/"); would work as well, though I've never bothered to try it.
You have it right but you have to many " in the script this line header("Location:"http://www.example.com/'.$id'/"); Code (markup): should be header("Location: http://www.example.com/".$id."/"); Code (markup):
<?php $id = $_GET['id']; header( "HTTP/1.1 301 Moved Permanently" ); //the original page was http://www.coyol.net/seo.php header( "Location: http://www.example.com/$id/" ); exit(); ?> PHP:
Shorter way to do 301 (or any other HTTP header): <?php $id = $_GET['id']; header( "Location: http://www.example.com/$id/", true, 301); exit(); ?> PHP: