httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Ionescu <robsie...@googlemail.com>
Subject Re: [users@httpd] rewrite rule
Date Mon, 29 May 2006 17:54:41 GMT
Mariusz Handke wrote:
> This wouldn't work (RewriteCond) since $2 and $3 are not known
> at this stage of rewriting process yet, but I'm still working on it

- That won't work. You can't use back references from mod_rewrite in a 
RegEx.

- They're known, as Axel-St├ęphane already said.

- You must use a kind of tricky solution using a regEx internal back 
reference.

- Why are you using a <Location> container at all?

So you expect /test/file.html to be rewritten to 
/test-redir.php?page=/test/file.html

expecting per-server context (in other words: main server config section 
or in a <virtualhost>, if you're using virtual hosts:

RewriteEngine On
RewriteCond %{HTTP_REFERRER}<>$1 !(/test/.+)<>\1$
RewriteRule ^(/test/[^/]*\.(html?|php))$ /test-redir.php?page=$1 [L,NS]

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


Mime
View raw message