SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2007
    London, UK
    0 Post(s)
    0 Thread(s)

    backslash in URL

    There is the following line
    PHP Code:
    $location $protocol .$_SERVER['HTTP_HOST'] .dirname($_SERVER['PHP_SELF']) .'/person_list.php'
    in index.php for an application i am using to learn PHP.

    I have my own WAMP setup with all the individual projects i am working on setup as virtual host. So this script is actually located in
    Hence is supposed to launce the page. However instead the turns to
    which gives

    Address Not Found        
    Firefox can't find the server at\.
    The browser could not find the host server for the provided address.
        * Did you make a mistake when typing the domain? (e.g. "" instead of "")
        * Are you certain this domain address exists?  Its registration may have expired.
        * Are you unable to browse other sites?  Check your network connection and DNS server settings.
        * Is your computer or network protected by a firewall or proxy?  Incorrect settings can interfere with Web browsing.
    What could be the cause as other scripts without
    $location = $protocol .$_SERVER['HTTP_HOST'] .dirname($_SERVER['PHP_SELF']) .'/person_list.php';
    launch OK.

  2. #2
    SitePoint Member TheDarkFool's Avatar
    Join Date
    Jun 2008
    0 Post(s)
    0 Thread(s)
    I had a similar issue a few days agon, and this was my code that was causing it, and also the way i fixed it is also shown by the comments.

    function redirect($url) {
    if (!headers_sent()) {
    header('Location: http://' . $_SERVER['HTTP_HOST'] .
    // By adding stripslashes around the driectory name, i fixed the problematic backslash IE; http://localhost\/index.php
    stripslashes(dirname($_SERVER['PHP_SELF'])) . '/' . $url);
    } else {
    die('Could not redirect; Headers already sent (output).');


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts