Scott Langham
Scott Langham

Reputation: 60411

Do web page URLs always have a subdomain

I'm writing a url parser. Do url's I'd type into an internet browser always have a subDomain?

I mean, will there always be something where www is in this example, and is there always a '.' between the sub-domain and the domain?

http://www.domain.com/path/page.htm

Thanks.

Upvotes: 0

Views: 416

Answers (2)

Cyril N.
Cyril N.

Reputation: 39899

There is tons of various possibilities, you can find :

So NO, there is not necessary a subdomain in the url. And there isn't a '.' between the sub-domain and the domain, when the sub-domain is empty.

If you are using PHP, you need to know that it already exists similar parser, like parse_url : http://fr.php.net/parse_url

And I'm sure there is also a parser in every (major) languages

Upvotes: 1

Oded
Oded

Reputation: 499302

No they don't.

If you go to http://example.com, you will see it doesn't redirect to a www subdomain.

And yes, there will always be a . between the parts of the hierarchy.

Upvotes: 1

Related Questions