Re: RewriteRule / RewriteCond don't interpolate server variables in pattern regex

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

 



2008/12/15 Pavel Ustyugov <p.ustyugov@xxxxxxxx>:
> 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]

---------------------------------------------------------------------
To unsubscribe, e-mail: users-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