Can I make an Apache running on Windows case-sensitive?

By : f3lix

The Windows file-systems (FAT, NTFS) do not care about the case of file names (case-insensitive). Consequently programs - like the Apache web server - running on windows handle file case-insenstive.

When you create web sites on Windows you inadvertently create links, etc. that do not match the case of the actual file name. You usually notice this mistakes not until you deploy the website onto case-sensitive file systems (as default on Linux, UNIX, ...).

Now, I would like to know if there is a way avoid these kind of mistakes by making the Apache web server somehow care about case even if the file-system does not care. I mean NTFS does differ between upper-case and lower-case letters in file names, so it should be theoretically possible to check whether file names match in a case-sensitive manner.

I know that naming conventions like "Only use lowercase" can help avoiding these kind of problems, but that does not help with existing files and is less convenient :-)

Also, not using Windows is not an option. I do not use Windows voluntarily and running the Apache on a different platform is not possible in this case.

By : f3lix


According to Apache documentation, it is not possible, because case insensitivity is embedded in Windows OS. But you can "reverse the problem" and turn the Apache server under Linux/Unix being case insensitive. Just add the following directives to your .htaccess:

RewriteEngine On
RewriteMap lowercase int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lowercase:$1} [R,L]

See the documentation here.

By : Luca

Windows, CAN be set to case-sensitive mode. NTFS volume is also support case-sensitive mode. If you installed UNIX interoperability before, your Windows possibly already turned into case-sensitive mode. I believe there is a switch in registry, but I forgot where it is, so I can't figure it our for you. :-(

It seems you can enable mod_spelling with directive CheckSpelling on in Apache configuration file.

Information and context found here:

Edit: the above was quoted for the reverse of the question, I am sorry. Someone does ask the same question that you do after that but never responds if the answer works or not. After looking further, there really doesn't seem to be a flag or any setting in apache itself to do this. Some people suggest trying to make the file system case-sensitive which does seem to be possible, but it looks like it causes more problems especially with other programs that are not expecting this.

Overall, if you cannot develop on another OS and you cannot go through and change all of your existing filenames to be lowercase (which is understandable), then it doesn't look like you really have many options. The only suggestion I would give you at this point is to try and get a testing environment, set up exactly the same as your production environment and test as much as possible before sending to production.

Sorry for the misunderstanding and that I can't be of more help.

This video can help you solving your question :)
By: admin