Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to move dozens of static websites (plain html) from Windows/IIS to Linux/Apache. As you may know, Linux is case-sensitive and I'm pretty sure there may be hundreds of html files with file references in one case and the referenced file in another case :(

Is there a tool that will check/fix this (by fixing the reference or renaming the files on the filesystem)?

Thanks! JFA

share|improve this question
Thanks all for the answers. I'm going to rename all files to lower-case and I'm going to use mod_rewrite (which I had no idea existed). Thanks again! I Love ServerFault! – JFA Oct 7 '09 at 15:24
up vote 1 down vote accepted

You may want to investigate simply enabling mod_speling. It can handle most of the case issues for you. If having the correct case isn't that important to you you could just enable this and move on.

share|improve this answer
Hey Zoredache thanks for the mod_speling tip! This is what I finally used as mod_rewrite was working properly but what if some remote users still upload stuff with case inconsistencies...(I'd have to then modify files to lower-case and so on...) This mod_speling is just what the doctor ordered! Thanks! It works beautifully! – JFA Oct 7 '09 at 22:51
If you feel this or another answer is the best you should consider accepting it. – Zoredache Oct 7 '09 at 23:30

Renaming the file to lower case isn't enough, because inbound links or bookmarks that have uppers are going to get "404 - file not found" errors. Rename the files, then use mod_rewrite to force urls to lower:

share|improve this answer

As far as I know there isn't a tool specifically designed to do this, however, if you want to delve into Linux a little bit, I would suggest creating a script using awk, sed and possibly grep to search for and replace all of the incorrect entries. However, this method might still take a while especially if you don't have much experience with the command line or shell scripting.

Alternatively, I believe IDEs such as Dreamweaver and whatnot have the ability to rename a file and update all of the references, so you may look into that. It means that you would have to do it for every file, but it might still be faster than trying to write a script that would catch all possible cases. Aptana is another IDE that might do this, although I have not used it for said purpose.

share|improve this answer

I would just use a shell script, perl, or the rename command to rename them all to lower case. This stackoverflow post has a bunch of different methods including shell and perl, but actually, most of those will break if spaces...

I would do the following with zsh, although not the fastest option probably:

for file in **/*.html; do 
    if [[ "$file" != "${(L)file}" ]]; then
        mv "$file" "${(L)file}"; 
share|improve this answer
Actually, most of those will break if spaces in the file name...sigh... – Kyle Brandt Oct 6 '09 at 19:51

You could serve your websites from a partition mounted in linux with filename translation set to case insensitive.

If you use a vfat (fat32) filesystem on linux you can mount it as follows

$ mount -t vfat /dev/XXX /var/windows/websites

Any filename inside /var/windows/websites will be treated the same way as windows does.

share|improve this answer
Thanks for this tip. I had no idea about this. Anyway, I think I'm going to try the other methods as I plan to usePOSIX ACL's and enable quotas on ext3. – JFA Oct 7 '09 at 15:22

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.