Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Show IP instead of URL?

  1. #1
    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 Show IP instead of URL?

    Just wondering how you can do this? I know URLs and IPs are linked and coherant, but if my IP for my site is 111.222.333.444 and my URL is mysite.com what do I need to do to make the URL resolve to 111.222.333.444 instead of mysite.com?

    I was thinking htaccess Mod_ReWrite, but I couldn't find anything??

    Ideas?

    And before you ask, it is just a novelty thing and will be done on only one part of my site (albeit the entire site at this point, LOL)

    Thanks.

    BLiZZ
    {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

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

    Default

    I know URLs and IPs are linked and coherant
    Not necessarily so, for a shared host.

    You can't have an IP section above 255 for a start
    I think you mean that you want to redirect from the domain to the IP, yes? This will be impossible on a shared host.

    According to HTTP/1.1, the user agent must include a "Host" HTTP header with each request. The header looks like this:
    Code:
    Host: www.mysite.com
    This allows multiple domains to be served from the same server -- shared hosting. If you access a site by its IP, the IP will be used in the Host header instead of the domain name. If the server uses shared hosting, it will get confused about which site to deliver.
    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!

  3. #3
    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

    Ahh, thanks for that Twey. I know it is possible, as I see sites all the time that have the IP in the url instead of the words. Just curious as to how they pulled it off.

    Thanks.
    {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

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

    Default

    If it's a dedicated host (it serves the same site no matter what Host header it's given) there's no problem with doing this.
    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!

  5. #5
    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

    That makes perfect sense. But the question still remains.. HOW?
    {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

  6. #6
    Join Date
    Sep 2005
    Location
    India
    Posts
    1,627
    Thanks
    6
    Thanked 107 Times in 107 Posts

    Thumbs up

    A site which is accessible through an IP Address rather than a Domain name is fully depends upon the Domain Name System (DNS).

    For example, if a party doesn't have a domain, then the only way to access their server is through their public IP Address. There are people who hosts their web sites through a Cable Modem without having a domain name like http://www.dynamicdrive.com. In order to access such web sites they have to enter their server's IP Address directly.

    If they are possessing a dynamic IP then they can setup a dynamic DNS. Dynamic DNS is a system which allows the domain name data held in a name server to be updated in real time. The most common use for this is in allowing an Internet domain name to be assigned to a computer with a varying (dynamic) IP address. This makes it possible for other sites on the Internet to establish connections to the machine without needing to track the IP address themselves

    Even if they have a valid domain name the site might be only available through their IP Address, the main reason for this is if they never made a DNS entry for that server.

    If you check out your DNS server, it is basically a list of names, and the IP address of the server that has that name. If you put a server on the Internet with a valid IP address, but you dont make an entry in DNS for it, then you will only be able to access it by the IP address.

    If you want you can visit a site (I don't know whether this site is popular or not ) http://64.233.167.104/

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

    Default

    That makes perfect sense. But the question still remains.. HOW?
    If it's a dedicated host, one can simply enter the IP of the site instead of its domain name.

    http://216.118.83.123/
    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!

  8. #8
    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 Twey
    If it's a dedicated host, one can simply enter the IP of the site instead of its domain name.

    http://216.118.83.123/

    Right I know that... but entering the dotted quad is not easy for most people.

    What I was looking for originally was like an htaccess line or Mod ReWrite to change that.

    For example, you can add or eliminate the WWW in the url whether the visitor uses it or not using Mod ReWrite lines.

    What I was looking for is similar in forcing the dotted quad to show even if the visitor entered the name URL.
    {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

  9. #9
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Set your domain name up to redirect to the IP instead of using a name server

  10. #10
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by BLiZZaRD
    Right I know that... but entering the dotted quad is not easy for most people.
    Which was precisely why host names and the DNS system was introduced.

    What I was looking for originally was like an htaccess line or Mod ReWrite to change that.
    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 (see Canonical Hostnames). However, these rules cannot be used within a .htaccess file, only the server configuration (mod_rewrite works differently at the directory level).

    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.

    Mike

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
  •