Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

An URL is in the format of:

scheme://server:port/pathname      

What is the differences between server and domain name here? //superuser.com/questions/ask is a (relative) URL.

The scheme is omitted (http:). The server is superuser.com. Maybe the server is equal to the domain name?

share|improve this question
    
People used to type go to e.g. http://www.example.com instead of http://example.com. That's because in the domain example.com (of e.g. an organization), the host known by convention as www served the web sites of that organization. –  Daniel Beck Jan 1 at 1:58

5 Answers 5

A server is a physical piece of hardware. This hardware has multiple IP addressess associated with it. A server is often referenced by referring to one of the IP addresses associated with it, or by the domain name which points to that IP address.

It is worth noting that a server can (and in the case of web sites, usually does) have multiple domains associated with it.

Technically speaking I would argue that it is incorrect to use "server:port" in an HTTP url - it should be domain:port, but it is common practice to do so anyway. In some addressing schemes (like FTP for example) calling it a server makes sense because there is no difference if the server is referred to by (any) domain associated with it or its IP address. [ HTTP has additional logic so the server can determine which domain is being referred to ]

share|improve this answer
    
Perhaps you should expand upon the 'L' of "URL" meaning "locator". The server is identified and located by the host and port in the authority component. –  JdeBP Jan 1 at 13:33

There is no difference in the given example.

In a way, the fully qualified domain name (FQDN) is the server name. But it is the (as the name says) fully qualified name. The name of the server would be superuser, but it lives in the com domain. So the full name would be superuser.com.

share|improve this answer

The domain name is a pointer to an IP address which hosts a server. Think of it as the difference between the street address "Example Street 42" (the domain name) and the house on that address (the server). You could argue forever about whether it's more semantically correct to call the domain name server or domain in an example like that. server and domain are not equal, but for the purposes of the example, equivalent.

The // syntax has a special meaning. It's a shorthand for "choose http:// or https:// as appropriate". The background for this syntax is that browsers have security restrictions on loading resources over the http protocol (unencrypted) from a https page (secure). The // syntax is beneficial when a server can serve the same content over both http and http. So instead of letting the server or a client side script decide which protocol to use based on the protocol of the requested page, the URL is simply always given as a URL starting with // which lets the browser handle this complexity.

For example before this shorthand was invented, you might see code like the following to load Google Analytics on a page that might be served through either http or https:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-y']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); 
ga.type = 'text/javascript'; ga.async = true; 

ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') 
+'stats.g.doubleclick.net/dc.js';

var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>

A more modern version of this would look something like:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-xxxxx-y']);
_gaq.push(['_trackPageview']);
</script>
<script type="text/javascript" src="//stats.g.doubleclick.net/dc.js"></script>

Nowadays it's also common for browser to exclude the http part of a URL in the address field, presumably to closer match what a typical user actually types into the field. However, the http part is still implied in this case. Depending on the browser, this behavior can be turned off so that the http part is always shown. And in some browsers, the http part becomes visible when you focus the address field.

share|improve this answer
    
Sorry, but this is wrong. the "//" means "Start of a network path reference", and is not shorthand for anything. [ See Section 4.2 of RFC3986 ]. The leaving out of the http/https part means that this should be derived from already known information - ie this part is relative. Also, http or https are only 2 schemes of a very large number of well over 100 accepted schemese - see en.wikipedia.org/wiki/… –  davidgo Jan 1 at 18:52
    
I'm not talking about the // per se. Shorthand refers to the fact that you can omit the http(s): part of a URL, in HTML5. What I said should be read in the context of how the question was asked. –  nitro2k01 Jan 1 at 19:04

You are probably referring to the host (which is part of authority).

STD 66 (the URI standard) defines:

The host subcomponent of authority is identified by an IP literal encapsulated within square brackets, an IPv4 address in dotted- decimal form, or a registered name.

[…]

host = IP-literal / IPv4address / reg-name

(These parts are defined in the linked section "3.2.2. Host".)

So the host can be an IP or a domain name.

Note that in the URI format you included in your question (which is not the standardized format), it’s not clear what exactly you mean with server. A component of the authority can also be user information (userinfo), e.g. for providing user name and password for a login.

share|improve this answer

Server here means its address.

http://74.125.224.72/

That's one of google's IPs. But I doubt anyone could be told to "74.125.224.72" his answer.

Domain names are just the way to transform IPs into something more human readable like

http://google.com/

So in both cases you've put the server. First way is its IP and second way is its domain name which is translated on the fly to its IP using DNS.

share|improve this answer
2  
"Server here means server IP" is nonsense. Also, Google has a lot of IP addresses, 74.125.224.72 is not universal. –  Daniel Beck Jan 1 at 1:56

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.