Re: Smarter rewrite rule

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

 



So if app1 app2 and appn are pippo pluto paperino, the rules will be:

ProxyPassMatch /(pippo|pluto|paperino) http://192.168.1.1/$1
RewriteRule ^/(pippo|pluto|paperino)$ /$1/ [R]
ProxyPassReverse / http://192.168.1.1/

Correct?

On Thu, Sep 22, 2011 at 12:41 PM, Rich Bowen <rbowen@xxxxxxxxxxx> wrote:

On Sep 22, 2011, at 2:23 AM, Michele Mase' wrote:

> Hi folks, I'using a lazy rule on my site:
> ...
> ProxyPass /app1/ http://192.168.1.1/app1/
> ProxyPassReverse /app1/ http://192.168.1.1/app1/
> RewriteRule ^/app1$ /app1/ [R]
> ProxyPass /app2/ http://192.168.1.1/app2/
> ProxyPassReverse /app2/ http://192.168.1.1/app2/
> RewriteRule ^/app2$ /app2/ [R]
> ....
> ProxyPass /appn/ http://192.168.1.1/appn/
> ProxyPassReverse /appn/ http://192.168.1.1/appn/
> RewriteRule ^/appn$ /appn/ [R]
> ...
> The list is from app1 till app60
>
> I have almost 60 rules and the conf file becomes difficult to read and edit (error prone)
> How could I use a smarter one?

ProxyPassMatch /app(\d+) http://192.168.1.1/app$1
RewriteRule ^/app(\d+)$ /app$1/ [R]
ProxyPassReverse / http://192.168.1.1/

That'll do all 180 rules you have above.

--
Rich Bowen
rbowen@xxxxxxxxxxx
rbowen@xxxxxxxxxx







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