httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Krist van Besien <krist.vanbes...@gmail.com>
Subject Re: [users@httpd] rewriterule help
Date Wed, 02 Sep 2009 10:41:20 GMT
On Wed, Sep 2, 2009 at 12:02 PM, Andrew Hole<andremailinglist@gmail.com> wrote:
> Hi guys!
>
> The following directive doesn't take into consideration the filename in URL:
>   RewriteCond %{DOCUMENT_ROOT}/bin/core/%1 -f



>    RewriteCond %{REQUEST_FILENAME} !-f
>    RewriteCond %{DOCUMENT_ROOT}/bin/core/%1 -f
>    RewriteRule ^(.*)$ /core/$1 [L]
>
> 192.168.1.167 - - [02/Sep/2009:10:57:34 +0100]
> [clappehr/sid#65c800][rid#87e078/initial] (2) init rewrite engine with
> requested uri /bin/adt/file.swf
> 192.168.1.167 - - [02/Sep/2009:10:57:34 +0100]
> [clappehr/sid#65c800][rid#87e078/initial] (3) applying pattern '^(.*)$' to
> uri '/bin/adt/file.swf'
> 192.168.1.167 - - [02/Sep/2009:10:57:34 +0100]
> [clappehr/sid#65c800][rid#87e078/initial] (4) RewriteCond:
> input='/bin/adt/file.swf' pattern='!-f' => matched
> 192.168.1.167 - - [02/Sep/2009:10:57:34 +0100]
> [clappehr/sid#65c800][rid#87e078/initial] (4) RewriteCond:
> input='R:/EHR/client/pfh/bin/core/' pattern='-f' => not-matched

%1 is the result of any capture performed during the matching in the
RHS of y RewriteCond. If you use it in the LHS it will be empty, as
you can see in the logs. Which is why this doesn't work.
You can capture the filename in the RewriteRule, and use that.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}/bin/core/$2 -f
RewriteRule ^(.*)/(.*)$ /bin/core/$1/$2 [L]

(I haven't acutally testet this, but this should work...)

Krist


-- 
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?

---------------------------------------------------------------------
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


Mime
View raw message