#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    9
    Rep Power
    0
    I recently got a domain name that uses redirection and masks my webspace's actually address. And I was wondering if there was something I could do with PHP so that if someone tries to access it from the full address instead of the domain, a script generates a "We have moved" page?

    I tried:

    <?
    if ($REQUEST_URI == "http://www.vebein.uklinux.net") {
    echo "We have moved to <a href=http://www.vebein.co.uk target=_top>here</a>.";
    exit;
    } else {
    exit;
    };
    ?>

    But since the requested url would be / it doesn't work, as it would display the we have moved page even when accessed from the correct address.

    Any help would be greatly appreciated.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    35
    Rep Power
    15
    It should work for HTTP 1.1 because it will send the full name.

    But it seems like a lot of effort to go to considering people can already see your site, most will not care what the URL is...

    HTH
    marty
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Posts
    9
    Rep Power
    0
    phpinfo() says that the server uses HTTP/1.0 but then at the bottom says that it uses HTTP/1.1
    (http://www.vebein.uklinux.net/test.php3)

    Now, when I set it up to display what HTTP version used it says HTTP/1.1, but still only shows / as the $REQUEST_URI

    I really have no clue what is going on with this, if anyone can help - it'd be really appreciated.

    (Please help - I don't wanna resort to JS!)
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    Niteroi, RJ, Brazil
    Posts
    30
    Rep Power
    14
    Did you tried something with $HTTP_REFERER ?

    Could be the solution...

    Just wondering, could you change the redirection to another page instead of your first page, so who accesses with the old URL would get a first page telling WE HAVE MOVED and the new address... Not best solution, but better than nothing...

    Example: Instead of Index.php3 use Index2.php3 or something...



    ------------------
    Eduardo Teixeira Cardoso
    PHP Programmer from Brazil
    idnotfound@vircio.com.br
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Aug 2000
    Location
    Indiana
    Posts
    614
    Rep Power
    15
    Use $HTTP_HOST instead. That will return with www.domain.com or subdomain.domain.com depending on which they entered.

Similar Threads

  1. Change ip url to domain
    By crypt1c_c0d3 in forum Apache Development
    Replies: 2
    Last Post: January 2nd, 2004, 09:55 AM
  2. mail(), header, character set not recognized
    By mr_fitz in forum PHP Development
    Replies: 0
    Last Post: December 11th, 2003, 10:25 AM
  3. question about header()
    By miseria in forum PHP Development
    Replies: 2
    Last Post: December 9th, 2003, 04:38 AM
  4. Does _msize() always return EXACT size of malloc'ed block?
    By Jason Doucette in forum C Programming
    Replies: 10
    Last Post: November 29th, 2003, 12:24 AM

IMN logo majestic logo threadwatch logo seochat tools logo