homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

Why does mod_rewrite work on unix but not on Windows?

10+ Year Member

Msg#: 30 posted 2:22 am on Sep 17, 2002 (gmt 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?





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

Msg#: 30 posted 5:33 am on Sep 17, 2002 (gmt 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.



10+ Year Member

Msg#: 30 posted 6:08 am on Sep 17, 2002 (gmt 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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved