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

832 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

URLs in general are case-sensitive, but most web-servers treat upper and lowercase letters the same. There is however no requirement for them to do so.

Generally it makes sense to handle anything a user might type in so that case doesn’t matter, with things like YouTube IDs wehre you want to cram as much information as possible into as short a string as possible and which usually just get copied and pasted not typed in this can justifiably ignored. (YouTube uses a modified BASE64 encoding for the ID, where each character can be one of 64 different possibilities)

It should be noted that DNS (the part of the URL that ends in .com or similar) is always case insensitive. The stuff that follows after original was just a path and file in the filesystem of the webserver, so if your webserver was running on an OS that had case sensitive filenames you also had case sensitive URLs unless you told the webserver to automatically translate everything to one case and were careful not to have two files with the same name when ignoring case.

Generally you as the one who sends in the URL to the server should always treat case as if it matters and the webserver (unless they have a good reason like youtube) should treat it as if it didn’t matter.

You are viewing 1 out of 22 answers, click here to view all answers.