httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yvand <yvand.sw...@gmail.com>
Subject Re: [users@httpd] Issue with URL Rewriting
Date Wed, 10 Jul 2013 08:00:07 GMT
Le 10/07/2013 00:18, Eric Covener a écrit :
>>> RewriteEngine On
>>> RewriteCond %{DOCUMENT_ROOT}/mysite/pictures%{REQUEST_URI} -f
>>> RewriteRule ^(.+) /mysite/pictures/$1 [L]
>> Unfortunately it doesn't work, because %{REQUEST_URI}contains also
>> /mysite...
>> Indeed if I request /mysite/icon.png, the input of RewriteCond is
>>      '/home/yvand/www/mysite/pictures/mysite/icon.png'
>>
>> My question is how can I access to the URI in RewriteCond?
>> When I say URI I do not mean REQUEST_URI but just icon.png in my example,
>> which is the value used by RewriteRule.
> Since you captured it, it's $1 in the RewriteCond.
>
> I think that's the only way to get at the suffix of the path you're
> implicitly comparing against when you do rewrite in htaccess.
Great! Thank you, it works!
I didn't think one instant it was possible to use $1 in RewriteCond..
In my opinion, it is strange that RewriteRule are treated before 
RewriteCond.

--yvand

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


Mime
View raw message