• Welcome to AcornDomains.co.uk, a friendly community for UK domain investors, developers and anyone interested in domain names.

    Whether you're looking to buy or sell domains, learn more about the UK domain market, get feedback on your names, or simply chat with other domainers, you're in the right place. AcornDomains has been bringing together people from across the UK domain industry for many years, from complete beginners to experienced investors.

    Have a look around, join the discussions and, if you haven't already, create a free account and introduce yourself.

php full retard

Status
Not open for further replies.
Joined
Aug 25, 2007
Posts
2,235
Reaction score
41
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)

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.
 
Have you tried to echo $userstypo - to see if that has what you want in it?
 
Im not on the main PC yet so cant see but is the PHP_URL_PATH calling the path of your 404 file. if your server has automatically redirected to 404.php
see if you can pull the referring url.
Also try echoing the header url to see what its building might be stuck in a loop
 
Status
Not open for further replies.
Top Bottom