Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Why does mod_rewrite work on unix but not on Windows?

2:22 am on Sep 17, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 30, 2002
votes: 0

Hi everyone,

I encountered something unusual regarding mod_rewrite the other day and was wondering if anyone had any insight...

The following mod_rewrite directive inside an .htaccess file works fine under Unix:

RewriteRule ^hEllo\.pl /cgi-bin/test.pl [L]

It will rewrite a URL of the form www.somedomain.com/hEllo.pl to www.somedomain.com/cgi-bin/test.pl.

BUT under Windows Apache it does not work!

If I change the capital 'E' in the RewriteRule to lower case 'e' under windows then it works but only for www.somedomain.com/hello.pl.

In other words under Windows I cannot apparently use mixed case in my URL's if mod_rewrite is to correctly identify those mixed case URL's and to process them according to RewriteRules.

Any insight as to why this is? I believe it has something to do with the fact that Windows is a case-insensitive operating system in terms of file names. While Unix is case sensitive.

But what exactly is happening under Windows that causes a URL with hEllo.pl to not be found (or mod_rewritten) while hello.pl will (if I change the 'E' to 'e')? What is the logic that Windows is following?

Any insight on this?



5:33 am on Sept 17, 2002 (gmt 0)

Senior Member

WebmasterWorld Senior Member jdmorgan is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Mar 31, 2002
votes: 0


I can't explain the logic of anything that runs on Windows... ;)

But you might want to try adding the NoCase flag to your RewriteRule, to see if it will then work the way you want it to.

RewriteRule ^hEllo\.pl /cgi-bin/test.pl [NC,L]

Reference the Apache mod_rewrite documentation [httpd.apache.org] for more details.


6:08 am on Sept 17, 2002 (gmt 0)

Junior Member

10+ Year Member

joined:Aug 30, 2002
votes: 0

Hi jdMorgan,

Thanks though I had been hoping that someone could explain why it behaved this way on Windows. Given that adding the no case flag would make it case insensitive which is the opposite of what I wanted to do.

Namely to have hello.pl be treated differently than hEllo.pl.

I have scripts that use letters (in upper and lower case), digits, and special symbols in their names and I had been hoping to be able to Rewrite calls to these scripts the same as I do under *nix.

Oh well...

I think Windows is by far one of the worst pieces of software I have ever used but I guess for now I will have to live with what I can do on it. Making whatever adjustments I can to work around it's quirks.