[url rewrite] uppercase changed to lowercase

[url rewrite] uppercase changed to lowercase

am 25.12.2004 12:00:57 von ad

Hi,

I use the following rewriting rule on a local winxppro box with apache
1.3.27.

RewriteEngine On
RewriteRule (.*)-(.*)-(.*).jpg http://$1.picture.com/$2/c$3.jpg

http://www.mydomain.com/vhost-trees-13.jpg

works perfect and is rewrited to :

http://vhost.picture.com/trees/13.jpg

But,

http://www.mydomain.com/vhost-CARS-13.jpg

does not work and is rewrited to :

http://vhost.picture.com/cars/13.jpg.

Well, CARS is rewrited to cars.

Any idea ? How can I configure mod_rewrite to keep the uppercases ?

Thanks.

Re: [url rewrite] uppercase changed to lowercase

am 25.12.2004 17:47:55 von ge0rge

"AD" wrote ...
>
> http://www.mydomain.com/vhost-CARS-13.jpg
> does not work and is rewrited to :
> http://vhost.picture.com/cars/13.jpg.
> Well, CARS is rewrited to cars.

Check the RewriteMap directive
http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#rewrit emap

Read the 'Other - External Rewriting Engine' section of
http://httpd.apache.org/docs-2.0/misc/rewriteguide.html

Re: [url rewrite] uppercase changed to lowercase

am 26.12.2004 10:50:55 von ad

ge0rge wrote:
> "AD" wrote ...
>
>>http://www.mydomain.com/vhost-CARS-13.jpg
>>does not work and is rewrited to :
>>http://vhost.picture.com/cars/13.jpg.
>>Well, CARS is rewrited to cars.
>
>
> Check the RewriteMap directive
> http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#rewrit emap
>
> Read the 'Other - External Rewriting Engine' section of
> http://httpd.apache.org/docs-2.0/misc/rewriteguide.html
>
>

Well, the bug is due to apache under windows. URI are lowercased before
being sent to or by the rewrite engine.

As my server is a linux one, I think it's too risky to locally change my
httpd.conf and .htacess files to fix this windows only bug.

Thanks anyway for your help.

Re: [url rewrite] uppercase changed to lowercase

am 26.12.2004 11:55:51 von ge0rge

"AD" wrote...
> ge0rge wrote:
> > "AD" wrote ...
> >
> >>http://www.mydomain.com/vhost-CARS-13.jpg
> >>does not work and is rewrited to :
> >>http://vhost.picture.com/cars/13.jpg.
> >>Well, CARS is rewrited to cars.
> >
> >
> > Check the RewriteMap directive
> > http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html#rewrit emap
> >
> > Read the 'Other - External Rewriting Engine' section of
> > http://httpd.apache.org/docs-2.0/misc/rewriteguide.html
> >
> >
>
> Well, the bug is due to apache under windows. URI are lowercased before
> being sent to or by the rewrite engine.
>
> As my server is a linux one, I think it's too risky to locally change my
> httpd.conf and .htacess files to fix this windows only bug.
>
> Thanks anyway for your help.

I must confess I don't understand what you are saying - if your Apache is
running in Linux then that's got nothng to do with a Windows bug.
Anyway, on second thought, rather than messing around with RewriteMap or
writing a perl script, you might like to consider changing your directory
names to lowercase and avoid all the hassle. Good luck.

Re: [url rewrite] uppercase changed to lowercase

am 27.12.2004 12:25:40 von karthikadmin

There is a ingore case option in apache to solve such cases that deals
with the uppper/lower cases. You need to write Rewrite Condition to
over come those instances.

I suppose the below code - add this before RewriteRule - hope this
might solve your problem.

RewriteCond %{HTTP_REFERER} *.jpg [NC]
Here NC referes to : Ignore Case or No case.

Re: [url rewrite] uppercase changed to lowercase

am 27.12.2004 12:44:37 von karthikadmin

I just found that the [NC] option can be also used alone with the
rewrite rule as
RewriteRule (.*)-(.*)-(.*).jpg http://$1.picture.com/$2/c$3.jpg [NC]