Tuesday, August 23, 2011

Are URLs on your servers "case sensitive"?


No, our Web servers do not treat URLs as being case sensitive. This means that your visitors won't see an error page if they follow a link that accidentally points to a file named "mypage.html" on your Web site if the file is actually named "MyPage.html": they'll see the "MyPage.html" file, just as you would expect.
However, there's a little more to it than that. The sections below have more details.

Some background information

We should first explain exactly what we mean by "case sensitive URLs". Some Web servers (usually Unix servers, such as the ones we use) consider URLs to be case-sensitive. That is, they would treat each of the following URLs as referring to a different file:
http://www.example.com/mypage.html
http://www.example.com/MyPage.html
http://www.example.com/MYPAGE.html
http://www.example.com/MYPAGE.HTML
If you visited "http://www.example.com/mypage.html" but the file was actually named "MyPage.html", these kinds of servers would display a "file not found" error.
Other Web servers (mostly Windows servers) would treat all these URLs as requests for the same file, because they use a file system that doesn't care about capitalization. Using an incorrectly capitalized link on these kinds of servers doesn't cause an error.
It's best to avoid this problem by making sure that the capitalization of any URL links matches the capitalization of your file names, ensuring that your files work on any kind of server. However, if you have an existing site, these errors can be difficult to find.

So do these kinds of links work on Tiger Technologies servers?

Yes. Our servers use special software that makes links work even if they contain capitalization errors. In other words, although we use Unix servers for reliability, our servers treat URLs in the same forgiving fashion as Windows servers.
That means that if you're transferring your Web site from a Windows server to Tiger Technologies, you don't need to worry about fixing the capitalization of links to avoid "file not found" errors. If your file is named "MyPage.html" and you have a link referring to "mypage.html", it will work, just as it did on a Windows server.
That's not to say that you shouldn't try to make your links match your file names. For technical reasons, pages that are accessed through miscapitalized links take a little more time to load. The delay is only a few milliseconds, but every little bit helps.

Some technical details

Advanced users may be interested in knowing how URLs can be case insensitive even though Unix servers use a case-sensitive file system. The answer is that we use an Apache Web server module called "mod_speling" (sic), which "fixes" URL requests that don't exactly match an existing file. We have mod_speling configured to look for matches that differ only in terms of case, which almost always "does the right thing".
We should mention that there is a (quite rare) potential issue when relying on mod_speling to fix miscapitalized links, which is that mod_speling does not change the fact that the actual file system can still allow files with different capitalization to exist simultaneously. This can cause subtle problems if you mistakenly upload two files with names that differ only in capitalization.
For example, if you upload a file named "mypage.html", then later upload a file named "MyPage.html", both files will exist on the disk, just as they would on any Unix server. The second upload will not replace the first file as it would on a Windows server. If you then use a link named "mypage.html", you're always going to see "mypage.html", even though you might be expecting to see the new "MyPage.html" file you more recently uploaded. Stranger still, if you use a link that doesn't match either file — say, "MYPAGE.HTML" — you'll appear to get one of the files at random. Again, just make sure that your link capitalization matches the file names you upload to avoid any potential problems.

Thanks to :
http://support.tigertech.net/case-sensitive

No comments:

Post a Comment