Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Show IP instead of URL?

  1. #11
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Quote Originally Posted by Mike
    As Twey noted, this will only work for dedicated hosts, or those that use IP-based virtual hosting. Doing this with a server dependent upon name-based virtual hosts will make the server useless.
    Luckily, his is one of those.
    What I was looking for is similar in forcing the dotted quad to show even if the visitor entered the name URL.
    The easiest way, if .htaccess is limited here, is to include a simple line at the top of the pages:
    Code:
    <?php if(strpos($_SERVER['HTTP_HOST'], 'cleverwasteoftime') !== false) header('Location: http://216.118.83.123' . $_SERVER['REQUEST_URI']); ?>
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  2. #12
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by mwinter
    Which was precisely why host names and the DNS system was introduced.
    Yeah.. someone got smart way back when, LOL I would have started at 1, then each site would have a number corresponding to date and order URL was made. But I have a pinache for the over-exuberant (is that even a word?)

    The mod_rewrite Apache module can do this and the examples in the Apache documentation should make it clear how do write the appropriate directives...
    Thanks.. I did look on Apache's site in the Mod Rewrite section.. but I got lost and nothing looked like what I wanted.

    [hr]
    Quote Originally Posted by Twey
    Luckily, his is one of those.
    must be IP based, as my non-profit sites can't afford dedicated yet

    The easiest way, if .htaccess is limited here, is to include a simple line at the top of the pages:
    Code:
    <?php if(strpos($_SERVER['HTTP_HOST'], 'cleverwasteoftime') !== false) header('Location: http://216.118.83.123' . $_SERVER['REQUEST_URI']); ?>

    Cool! I will give all these a try. Thanks guys
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

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