Trying to create a simple script that redirects a 404 error to another page,
hoping someone can tell me why this does not append the variable to url.. gunna kick myself i know (don't say i need to do something in .htaccess)
want to send them to: domain.com/dir/$userstypo if they go domain.com/$userstypo if that makes sense.
Apologies for me shite php...
ta.
hoping someone can tell me why this does not append the variable to url.. gunna kick myself i know (don't say i need to do something in .htaccess)
Code:
<?
/* Redirect to a different page than that was requested */
$userstypo = explode('/', parse_url($userstypo, PHP_URL_PATH));
$userstypo = end($userstypo);
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'some-dir';
header("Location: http://$host$uri/$extra/$userstypo");
exit;
?>
want to send them to: domain.com/dir/$userstypo if they go domain.com/$userstypo if that makes sense.
Apologies for me shite php...
ta.