You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Eric Lemes <er...@gmail.com> on 2006/06/06 23:01:50 UTC

[users@httpd] Help with mod_rewrite

Hello there,

I'm using apache 2.0.58 to setup a Subversion server.

It's running in Windows 2003 server (against my will), and I having troubles
with SVN + case insensitive file system in some issues that I think I can
solve with mod_rewrite.

I read the manual and tutorials with mod_rewrite and didn't understand how
the "rewrite" works exactly.

I need to rewrite a url, translating to lowercase only the repository dir,
in the example:

http://myserver/svn/MyRepos/AnyDirWithAnyCase

This should be translated to

http://myserver/svn/myrepos/AnyDirWithAnyCase.

I tried RewriteRule (\/.*\/.*) ${lowercase:{$1}} [L], but it didn't work (I
don't understand how to tell it that $1 is what I need in lowercase).

In my httpd.conf (I don't matter if other URL's rewrited. I use this server
only for subversion).



Anyone can help me?

Thanks in advance.


Eric Lemes

Re: [users@httpd] Help with mod_rewrite

Posted by Robert Ionescu <ro...@googlemail.com>.
Eric Lemes wrote:
> The problem here is that after the myrepos path, there mustn't be any
> changes in the case.

So you need to fine tune the RegEx,

RewriteRule ^/svn/([^/]+)/(.*) /svn/${lower:$1}/$2 [PT]

-- 
Robert


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Help with mod_rewrite

Posted by Eric Lemes <er...@gmail.com>.
Thanks Robert.

The problem here is that after the myrepos path, there mustn't be any
changes in the case.

Thanks anyway.


[]'s

Eric Lemes

On 6/6/06, Robert Ionescu <ro...@googlemail.com> wrote:
>
> Eric Lemes wrote:
> > I need to rewrite a url, translating to lowercase only the repository
> dir,
> > in the example:
> >
> > http://myserver/svn/MyRepos/AnyDirWithAnyCase
> >
> > This should be translated to
> >
> > http://myserver/svn/myrepos/AnyDirWithAnyCase.
> >
> > I tried RewriteRule (\/.*\/.*) ${lowercase:{$1}} [L], but it didn't work
> (I
> > don't understand how to tell it that $1 is what I need in lowercase).
>
> eg.
>
> RewriteMap lower int:tolower
> RewriteRule ^/svn/(.*) /${lower:$1} [PT]
>
> will transform anything starting with /svn/ to lowercase.
>
> --
> Robert
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Help with mod_rewrite

Posted by Robert Ionescu <ro...@googlemail.com>.
Eric Lemes wrote:
> I need to rewrite a url, translating to lowercase only the repository dir,
> in the example:
> 
> http://myserver/svn/MyRepos/AnyDirWithAnyCase
> 
> This should be translated to
> 
> http://myserver/svn/myrepos/AnyDirWithAnyCase.
> 
> I tried RewriteRule (\/.*\/.*) ${lowercase:{$1}} [L], but it didn't work (I
> don't understand how to tell it that $1 is what I need in lowercase).

eg.

RewriteMap lower int:tolower
RewriteRule ^/svn/(.*) /${lower:$1} [PT]

will transform anything starting with /svn/ to lowercase.

-- 
Robert

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org