Shared web hosting is also for the case of different people, each with one or many different domain names, in addition to the cases of one or more different sub-domains.
For example, I have about 30 domain names on a single web hosting account. The files for my "First" domain name are located in the root of my "public_html" folder. This folder is in my "home" directory, so something like: ".../.../username/home/public_html".
And, in the root of this folder are folders for each sub-domain of my "First" domain name. Lets say my "First" domain name is "example.com", and I have some sub-domains. The files will be organized like this:
"example.com" --> ".../username/home/public_html"
"a.example.com" --> ".../username/home/public_html/a"
"b.example.com" --> ".../username/home/public_html/b"
"c.example.com" --> ".../username/home/public_html/c"
Plus, there is another folder in public_html for each of my other additional domain names (referred to as "add-on" domains in my hosting).
"domain2.com" --> ".../username/home/public_html/somefolder"
"domain3.com" --> ".../username/home/public_html/otherfolder"
"a.domain2.com" --> ".../username/home/public_html/somefolder/a"
"b.domain3.com" --> ".../username/home/public_html/otherfolder/b"
Plus, many other people (perhaps dozens of people), each having a different "username", all have hosting accounts on the same computer, and each of these other users may have one or many domains and sub-domains, with their files organized in a similar fashion.
All of these users, including me, all share the same IP address. If I want, I could pay extra to have one or more unique IP addresses for my domains.
Originally, at least in concept, I believe the internet was setup with each domain name to have a different IP address. I think around the time of HTTP/1.1 this was changed to allow multiple domain names to share a single IP address. This was done then because of the concern of running out of IP addresses.
@AthomSfere - Indeed. I think it's interesting that he mentioned it, however, in that it reminds us what it was like to have, at one time, not know what we know now. To the initiated, it sounds absurd to think there might be laws against shared IP addresses. However, reflect on the assumptions you had to make about esoteric subjects before you understood them. New concepts in software are often a black, murky shape that take some time to figure out. In the meantime, the brain fills in some blanks by making up what sometimes amounts to gibberish. It's all part of the learning process. – bubbleking – 2016-02-19T20:27:42.357
14Why would there be laws against this? – Austin T French – 2013-04-02T22:14:37.387
It is a little irritating, since spammers may create hundreds of different domains linked to one IP. But the technique has many legitimate uses. – Daniel R Hicks – 2013-04-02T23:55:01.147
7Disallowing it will increase web hosting costs and we will run out of IPV4 addresses immediately. – Yousf – 2013-04-03T09:22:00.023