How does the URL on YouTube videos know that the unique part of the URL is case-sensitive?

826 views

Whenever I go to YouTube or any website at all, it doesn’t matter if I write the website name in lowercase letters or uppercase letters, I will land on the same website. But whenever we go to a video and even replace 1 letter with lowercase or uppercase, the link doesn’t work.

How does the URL know that one section is not case-sensitive while the other section is case-sensitive?

I can understand why that’s the case. To keep the URLs unique. just in case something similar comes up. But what’s happening behind the scenes?

In: 52

22 Answers

Anonymous 0 Comments

Domain is not case sensitive. (The www.website.com part). This is for your safety because if Amazon owned www.amazon.com and some malicious entity owned www.Amazon.com they could make there website look exactly like Amazon and just steal your credit card information.

The part after the / is data sent to the server. The part before the ? Is the path and the part after is the parameter.

Example url
youtube.com/watch?v=dQw4w9WgXcQ

Watch is the path. Basically tells the server where you are and what you are doing. In this case you are trying to watch a video. There is not a great reason to have this case sensitive other than it’s more work for the developer to deal with both upper and lower case paths. However the important part is that if you mess up you are still requesting data from youtube so it’s not a safety concern.

The path after the ? v=dQw4w9WgXcQ. Is basically saying v( a variable that probably means video) is dQw4w9WgXcQ. This random string of letter is the unique identifier for the video and having it be case sensitive is very important because it allows youtube to have MUCH more possible unique identifiers to assign.

Anonymous 0 Comments

Everything *before* the domain (.com, .org, .gov, etc.) is sent by the browser to, and is processed by, a domain name server (DNS) to provide the server’s IP address. The DNS server doesn’t care about upper or lower case because at the time it wasn’t considered necessary to distinguish.

Then the rest of the URL is sent by the browser to the server at that IP address, which looks at everything *after* the domain and figures out what to do with it. So /directoryname/pagename.html or /documentname.pdf or /imagename.jpg would tell the server to send a certain document. And if it’s something that starts with a question mark, usually it’s a set of variables that the server uses to decide what to do next.

So for YouTube, they’ve decided to use short strings of text that are case-sensitive to compactly designate the very large number of videos that are stored. Paying attention to case allows them to greatly increase the number of unique files that can be identified with those few characters.