Forum Moderators: coopster
this is what i wrote - but it doesn't work. how could i get this sample below to permanently redirect
redirect 301 /card_details.php?cardid=74 http://www.example.com/card_details.php?cardid=84
thank you all
[edited by: dreamcatcher at 12:30 pm (utc) on Nov. 25, 2008]
[edit reason] use example.com. Thanks. [/edit]
do you mean I can't do it in the htaccess file?
This is the PHP forum. Using .htaccess wouldn't be on topic here. If you want to redirect from a PHP script, just use the header() function (see the docs for how it's used) in your code. Otherwise, please explain "i need to redirect a dynamic created php code" a bit better.
if($_GET["cardid"]==74)
{
header("Location: http://www.example.com/card_details.php?cardid=84");
exit;
}
[edited by: Anyango at 6:32 am (utc) on Nov. 25, 2008]
[edited by: dreamcatcher at 12:30 pm (utc) on Nov. 25, 2008]
[edit reason] use example.com. Thanks. [/edit]
header ('HTTP/1.1 301 Moved Permanently');
header("Location: http://www.example.com/example.php?id=84");
If you don't include the 301 header it will default to a 302 redirect which is unlikely to achieve what you want.