Membership is FREE, giving all registered users unlimited access to every Acorn Domains feature, resource, and tool! Optional membership upgrades unlock exclusive benefits like profile signatures with links, banner placements, appearances in the weekly newsletter, and much more - customized to your membership level!

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.

The Rule #1

Do not insult any other member. Be polite and do business. Thank you!

Members online

Premium Members

New Threads

Domain Forum Friends

Our Mods' Businesses

*the exceptional businesses of our esteemed moderators
General chit-chat
Help Users
  • No one is chatting at the moment.
      There are no messages in the current room.
      Top Bottom