httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Павел Устюгов <p.ustyu...@inets.ru>
Subject Re[2]: [RESOLVED] RewriteRule / RewriteCond don't interpolate server variables in pattern regex
Date Tue, 16 Dec 2008 06:20:42 GMT
Hello, Bob Ionescu.

> 2008/12/15 Pavel Ustyugov <p.ustyugov@inets.ru>:
>> RewriteEngine On
>> RewriteBase /
>> RewriteCond %{REMOTE_USER} !^$
>> RewriteRule !^usr/%{REMOTE_USER}/ /usr/%{REMOTE_USER}/ [R]
>> =======================================
>> If user try to get out from own dir, server forcibly redirect him to correct
>> dir.
>> But, this rules don't work, because mod_rewrite not interpolate server
>> variables in pattern (i see this in log file).

> Use a RegEx internal backreference to compare two values like

> RewriteCond $1<>%{REMOTE_USER} !^([^<]+)<>\1$
> RewriteRule ^usr/([^/]+)/ /usr/%{REMOTE_USER}/ [R]

Huge thanks for greap idea. Genius trick!

I add some additions and obtain work config:

RewriteCond %{REMOTE_USER} !^$
RewriteCond $1<>%{REMOTE_USER} !^([^<]+)<>\1$
RewriteRule ^usr/([^/]+)/ /usr/%{REMOTE_USER}/ [R,L]
RewriteRule !^usr/[^/]+/ /usr/%{REMOTE_USER}/ [R,L]





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


Mime
View raw message