Question for using mod_rewrite to do proxying

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

 



Hi everyone,

I have the following rules with mod_rewrite:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^blog/(.*?)$ http://blog.example.com/$1 [P]

RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)?$ http://www.example.com/$1 [L,R=301]

What I'm trying to achieve, and it works up to 90% of my expectations, is that any hits to http://www.example.com/blog proxies over to http://blog.example.com. They're two physically separate boxes.

The issue I have here is that if I visit http://blog.example.com/some/dir/foo.php it works fine. However, if I go to http://www.example.com/blog/some/dir/foo.php, it does not work properly.

Is there a major flaw in my rules that's preventing me from doing this proxy of all requests from http://www.example.com/blog to http://blog.example.com/ ?


Thanks all!




[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