This is a discussion on mod_rewrite/Win32 within the Apache Web Server forums, part of the Web Server and Related Forums category; I have Apache 1.3.33 on my local Win32 machine and generally try to keep the same environment locally ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have Apache 1.3.33 on my local Win32 machine and generally try to keep
the same environment locally as on the web server that hosts my pages. And mainly that approach works very well indeed. But there's one thing I simply don't understand. I have this url: http://example.com/StartThis/ and I want this to end up as http://example.com/startthat/ Trivial one-liner with mod_rewrite. But this only works correctly on the remote web server and *not* on my local machine. After some lengthy trial and error sessions I seem to have found a possible reason: it looks as if mod_rewrite -- but only on Win32 -- gets all its strings already in lowercase, so the match never happens. Am I overlooking something obvious? Or is that known behaviour? -- cheers thomasl mail: thomas.lauer@virgin.net |
|
|||
|
Thomas Lauer wrote:
> I have Apache 1.3.33 on my local Win32 machine [...] > But there's one thing I simply don't understand. I have this url: > http://example.com/StartThis/ and I want this to end up as > http://example.com/startthat/ > > Trivial one-liner with mod_rewrite. But this only works correctly on the > remote web server and *not* on my local machine. After some lengthy > trial and error sessions I seem to have found a possible reason: it > looks as if mod_rewrite -- but only on Win32 -- gets all its strings > already in lowercase, so the match never happens. Did you check the RewriteLog (needs to be enabled first, use RewriteLoglevel 5) > Am I overlooking something obvious? Or is that known behaviour? AFAIK there was something... but check the RwriteLog. -- Robert |
|
|||
|
Robert Ionescu <robsiegen@googlemail.com> wrote:
> > But there's one thing I simply don't understand. I have this url: > > http://example.com/StartThis/ and I want this to end up as > > http://example.com/startthat/ > > > > Trivial one-liner with mod_rewrite. But this only works correctly on the > > remote web server and *not* on my local machine. After some lengthy > > trial and error sessions I seem to have found a possible reason: it > > looks as if mod_rewrite -- but only on Win32 -- gets all its strings > > already in lowercase, so the match never happens. > > Did you check the RewriteLog (needs to be enabled first, use > RewriteLoglevel 5) I did. That's how I realised that mod_rewrite gets the strings seemingly all in lowercase. If I try to load http://example.com/StartThis/ what actually appears as incoming in the RewriteLog is http://example.com/startthis/, from the very first line. (And there's no rule in my ruleset that would change case anyway.) Hm...? -- cheers thomasl mail: thomas.lauer@virgin.net |
|
|||
|
Thomas Lauer wrote:
> Robert Ionescu <robsiegen@googlemail.com> wrote: > >>> But there's one thing I simply don't understand. I have this url: >>> http://example.com/StartThis/ and I want this to end up as >>> http://example.com/startthat/ >>> >>> Trivial one-liner with mod_rewrite. But this only works correctly on the >>> remote web server and *not* on my local machine. After some lengthy >>> trial and error sessions I seem to have found a possible reason: it >>> looks as if mod_rewrite -- but only on Win32 -- gets all its strings >>> already in lowercase, so the match never happens. >> Did you check the RewriteLog (needs to be enabled first, use >> RewriteLoglevel 5) > > I did. That's how I realised that mod_rewrite gets the strings seemingly > all in lowercase. If I try to load http://example.com/StartThis/ what > actually appears as incoming in the RewriteLog is > http://example.com/startthis/, from the very first line. (And there's no > rule in my ruleset that would change case anyway.) It seems that mod_rewrite receives in per-server context the URL in its correct case, init rewrite engine with requested uri /hAllo/ applying pattern '^/hAllO' to uri '/hAllo/' pass through /hAllo/ but it does not match without ine NC-Flag so there must be sthg. else between mod_rewrite and the regEx engine. In per-dir context, a URL-to-filename translation has already taken place, so may be all files are resolved in lowercase on systems, where the case doesn't matter? So mod_rewrite receives a lowercase filepath here. -- Robert |
|
|||
|
Robert Ionescu <robsiegen@googlemail.com> wrote:
> Thomas Lauer wrote: > > Robert Ionescu <robsiegen@googlemail.com> wrote: > > > >>> But there's one thing I simply don't understand. I have this url: > >>> http://example.com/StartThis/ and I want this to end up as > >>> http://example.com/startthat/ > >>> > >>> Trivial one-liner with mod_rewrite. But this only works correctly on the > >>> remote web server and *not* on my local machine. After some lengthy > >>> trial and error sessions I seem to have found a possible reason: it > >>> looks as if mod_rewrite -- but only on Win32 -- gets all its strings > >>> already in lowercase, so the match never happens. > >> Did you check the RewriteLog (needs to be enabled first, use > >> RewriteLoglevel 5) > > > > I did. That's how I realised that mod_rewrite gets the strings seemingly > > all in lowercase. If I try to load http://example.com/StartThis/ what > > actually appears as incoming in the RewriteLog is > > http://example.com/startthis/, from the very first line. (And there's no > > rule in my ruleset that would change case anyway.) > > It seems that mod_rewrite receives in per-server context the URL in its > correct case, > > init rewrite engine with requested uri /hAllo/ > applying pattern '^/hAllO' to uri '/hAllo/' > pass through /hAllo/ > > but it does not match without ine NC-Flag so there must be sthg. else > between mod_rewrite and the regEx engine. > > In per-dir context, a URL-to-filename translation has already taken > place, so may be all files are resolved in lowercase on systems, where > the case doesn't matter? So mod_rewrite receives a lowercase filepath here. Unfortunately, I can only use mod_rewrite in a per-dir context (I can of course use it on my local machine in whatever way I please but that would defeat the original purpose: to have exactly the same setup locally and remote). Anyway, perhaps something along these lines (i.e. Win32 being a case-insensitive system so it shouldn't matter anyway whether or not the incoming pathnames and filenames are lowercase) is happening here. However, the days when a URI contained real filenames are long gone. mod_rewrite itself is one of the greatest tools to perform all sorts of remappings between arbitrary input strings and real filenames. This limitation (if it is indeed a limitation and not some odd configuration option I have overlooked) is a rather severe one, all the more as it renders a Win32 Apache incompatible to its *x sibling. Sigh. -- cheers thomasl mail: thomas.lauer@virgin.net |