Jump to content

[SOLVED] Rewrite all proxy requests


silmarilwest

Recommended Posts

Hi there,

I am trying to create a mod_rewrite rule that will take all proxy requests to my non proxy server and rewrite them to display my custom error page. Here is what I have so far based on my limited knowledge (located in httpd.conf, Apache 2.2 on Windows XP 32bit):

 

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_PROXY_CONNECTION} !^$
RewriteRule ^/$ http://myserver/subdir/error.html [R]
</IfModule>

 

It seems to work for base website addresses, for example if I try to proxy cnn.com the address is changed to myserver/subdir/error.html, but when there is a subdirectory or file specified (cnn.com/index.html or cnn.com/subdir/subsubdir/) the rewrite rule not longer seems to work. I have limited understanding of what I wrote and it clearly is not working as I intended. Is there a way to rewrite all proxy requests to a single page? Thanks  :)

Link to comment
https://forums.phpfreaks.com/topic/77378-solved-rewrite-all-proxy-requests/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.