Need help on RewriteCond and RewriteRule

Hi,

Client IP: 192.168.1.1
Apache IP: 192.168.1.2

Below worked when accessed from 192.168.1.1 to http://192.168.1.2/proxy.pac and request was redirected to http://192.168.1.2/proxy2.pac

Options +FollowSymlinks
RewriteCond %{REMOTE_HOST} ^192\.168\.1\.
RewriteCond %{REQUEST_URI} proxy\.pac$
RewriteRule $ /proxy2.pac [R=302,L]

But how to configure Apache to return the contents of proxy2.pac and maintain the url as http://192.168.1.2/proxy.pac?

Thanks!

ctks,

Delete the R=302 flag.

Regards

DK

Hi Dk,

It works after removing R=302 flag.

But sometimes when I use IE browser to access http://192.168.1.2/proxy.pac, IE seems to run in an endless loop?

ct,

Computers do not understand sometimes, i.e., there is no middle ground between a zero and a one.

That said, add a start anchor, a ^, before the $ in your RewriteRule’s regex.

Regards

DK