What is the Difference Between Pinging With and Without http://?

what-is-the-difference-between-pinging-with-and-without-http photo 1

If you are experimenting with and learning about pinging a website, you may be surprised by the results based on “what” you ping. Today’s SuperUser Q&A post helps clear things up for a confused and frustrated reader.

Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.

Screenshot courtesy of Cristianzambrano (Wikimedia Commons).

The Question

SuperUser reader Saransh Singh wants to know what the difference between pinging with and without http:// is:

I am trying to ping my website http://www.example.com/ and it resolves to an unknown IP address, then it times out.

what-is-the-difference-between-pinging-with-and-without-http photo 2

But when I ping example.com, it works. What am I missing or not understanding here?

Note: example.com was substituted for the actual website at SuperUser.

What is the difference between pinging with and without http://?

The Answer

SuperUser contributor DavidPostill has the answer for us:

The argument to ping is a host name (or an IP address). So the following will all work:

what-is-the-difference-between-pinging-with-and-without-http photo 3

On the other hand, this will not work as http://www.example.com/ is an HTTP Uniform Resource Locator (URL), not a valid host name (although part of it is a host name).

what-is-the-difference-between-pinging-with-and-without-http photo 4

A HTTP URL is made up of 4 parts:

  • Scheme — Always present
  • Host Name — Always present
  • Path or Stem — Always present but sometimes is null
  • Parameters — Optional

A ping will not normally recognize URLs as a valid destination host name.

Note

Not all URLs have the format mentioned above. A complete URL consists of a naming scheme specifier followed by a string whose format is a function of the naming scheme. The format of URLs is defined in the IETF specification Uniform Resource Locators (URLs). *This is a different website address from the one shown for URL above.

DNS Hijacking

An exception to the above can happen if the DNS server (which resolves host names to IP addresses) is configured to return a valid IP address even if an invalid host name is supplied. This can happen if an ISP is hijacking your DNS queries.

From the answer Why is ping resolving to an IP 198.105.254.228 for any random host name that i type? by Michael Hampton:

  • They are trying to be “helpful” by redirecting requests for nonexistent domains to a white label service that provides search results and advertising, from which everyone but you gets a cut of the revenue. Fortunately, they do have a preferences page where you can supposedly turn it off.

Make sure to read through the other helpful answers via the thread link shared below!


Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.

Article What is the Difference Between Pinging With and Without http://? compiled by Original article here

More stories

How to Open a Word Document as Read-Only

Opening a Word document as read-only helps prevent unintentional changes you make to the document from being saved. Read-Only mode does not allow you to make any changes to the document, preventing you from inadvertently saving changes. We will show you how to open any Word document as read-only.

How to Build a New Custom PC Without Touching a Screwdriver

We love building our own computers but it takes quite a bit of time. If you love to build but find you don’t have the time, a custom-built PC still gives you control over your components, while leaving the actual assembly up to someone else.

How to Select a Wallpaper Image on Your Android Device

Your Android device came with a default image set as the wallpaper on the Home screen. However, if you want a different image as your wallpaper, this is easily changed. There are several images included in the Android system or you can use one of your own images.

Why Is the Dialogue So Quiet on My HDTV?

We’ve all been there: the characters on screen are talking and it’s way too quiet so you crank up the volume only to be blasted by a loud explosion two seconds later. Why is the dialogue so quiet and what can you do to fix it? Read on as we show you how to tame wild swings in TV audio output.