Domain Manage

php full retard

Discussion in 'Website Design' started by julian, Oct 21, 2014.

Thread Status:
Not open for further replies.
  1. julian United Kingdom

    julian Banned

    Joined:
    Aug 2007
    Posts:
    2,271
    Likes Received:
    42
    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.
     
  2. Domain Forum

    Acorn Domains Elite Member

    Joined:
    1999
    Messages:
    Many
    Likes Received:
    Lots
     
  3. tifosi United Kingdom

    tifosi Well-Known Member

    Joined:
    Oct 2004
    Posts:
    3,128
    Likes Received:
    45
    Last edited: Oct 21, 2014
  4. julian United Kingdom

    julian Banned

    Joined:
    Aug 2007
    Posts:
    2,271
    Likes Received:
    42
    I really need this to work independent of htaccess settings if possible.

    If anyone wants to do this work for some paypal let me know.


     
  5. redbird United Kingdom

    redbird Well-Known Member

    Joined:
    Sep 2005
    Posts:
    1,123
    Likes Received:
    18
    Have you tried to echo $userstypo - to see if that has what you want in it?
     
  6. AssetDomains United Kingdom

    AssetDomains Well-Known Member

    Joined:
    Feb 2010
    Posts:
    2,951
    Likes Received:
    52
    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
     
Thread Status:
Not open for further replies.

Share This Page