httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joshua Slive <jos...@slive.ca>
Subject Re: mod_rewrite && apache 2 problem
Date Mon, 20 May 2002 23:40:40 GMT

On Tue, 21 May 2002, Marten Lehmann wrote:

> Hello,
>
> I've got the following lines in .htaccess:
>
> RewriteEngine On
> #RewriteBase /
> RewriteCond %{REQUEST_URI} ^/sess/[a-z0-9]{4}/(.*)
> RewriteRule ^.* /apps/$1 [L]
> RewriteCond %{REQUEST_URI} !^/soap/
> RewriteCond %{REQUEST_URI} !^/redirect/
> RewriteRule ^.* /redirect/
>
> What they should do is: Rewrite e.g. /sess/0573/test.pl to /apps/test.pl
> and don't allow test.pl to be called directly. Grant access to the
> /soap-directory and rewrite everything else to /redirect.

A couple general hints:

1. Use the RewriteLog to debug!

2. $1 refers to matches in the current RewriteRule.  You want to use %1,
which is a "backreference", to get matches from a previous RewriteCond.

3. I'm not sure where the {4} comes from.  I certainly don't see it in the
mod_rewrite docs.

Now, here is a guess that simplifies things:

RewriteEngine On
RewriteBase /
RewriteRule ^/sess/[a-z0-9][a-z0-9][a-z0-9][a-z0-9]/(.*) /apps/$1 [L]
RewriteCond %{REQUEST_URI} !^/soap/
RewriteCond %{REQUEST_URI} !^/redirect/
RewriteRule ^.* /redirect/

Joshua.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message