silmarilwest Posted November 14, 2007 Share Posted November 14, 2007 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 More sharing options...
silmarilwest Posted November 21, 2007 Author Share Posted November 21, 2007 Nevermind I figured it out. <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_PROXY_CONNECTION} !^$ RewriteRule ^/.*$ http://myserver/subdir/error.html [R] </IfModule> Link to comment https://forums.phpfreaks.com/topic/77378-solved-rewrite-all-proxy-requests/#findComment-396320 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.