Re: rewriterule help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 2, 2009 at 12:02 PM, Andrew Hole<andremailinglist@xxxxxxxxx> 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@xxxxxxxxx
krist@xxxxxxxxxxxxx
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@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux