Having issues with rewrite proxy rules, serving files to both old and new servers.

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

 



I'm trying to write rules that will serve files on the new server, while proxying files that don't exist, to the old server.  The proxy rules work fine, sending missing files and directories to the old server.

The problem I'm having is http://new-server.example.com/blah (/blah/ exists on the new server) is passed through to the proxy rules and routed to the old server.

The reason for attempting the skip is because http://new-server.example.com/blah falls through to the "proxy section" and passes http://new-server.example.com/blah/index.php.  Index.php doesn't exist on the new server, index.html does.  The "proxy section" doesn't follow all the index file possibilities in DirectoryIndex, it just looks at the first one.

So I end up with error message, "The requested URL /blah/index.php was not found on this server."

Does anyone know why my "skip, proxy section" isn't working?  If there's a better way, I'm all ears.  Thanks.

RewriteEngine On
# skip, proxy section
RewriteCond /var/www/html/%{REQUEST_FILENAME}       -f  [OR]
RewriteCond /var/www/html/%{REQUEST_FILENAME}       -d
RewriteRule .? - [S=4]

# proxy section
RewriteCond /var/www/html/%{REQUEST_FILENAME}       !-f
RewriteCond /var/www/html/%{REQUEST_FILENAME}       !-d
RewriteRule ^/(.*) http://old-server.example.com/$1 [P]
ProxyPassReverse / http://old-server.example.com/

--
Kent




[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