I've searched the web and am baffled why my maintenance page redirect and rewrite rules fail to work for just about any proxied material or anything that's finding through https.

I'm utilizing an Apache 2.2.3 server with tomcat 6..24 placed on it.

I've the next htaccess file:

Options +FollowSymlinks
RewriteCond %{REQUEST_URI} !/maintenance.html
RewriteCond %{REQUEST_URI} !/images/(.*)$
RewriteCond %{REQUEST_URI} !/scripts/(.*)$
RewriteCond %{REQUEST_URI} !/styles/(.*)$

RewriteCond %{REMOTE_ADDR) !^123.456.789.100

RewriteRule $ /maintenance.html [R=302,L]

It redirects all my http pages towards the maintenance page and every one of my images, scripts, and designs work correctly. However, it's not redirecting any https pages that are proxied from another machine.

So http://mypage.com/documents redirects to maintenance while https://mypage.com/users doesn't redirect.

Regrettably customers is really a proxied service that endures a after sales server whereas documents is really a static page around the front-end server.

It is possible to method to pressure proxied and/or https material to become rerouted too? Or can i disable mod_proxy during my htaccess file to ensure that nothing will get proxied?

  • Look at your SSL virtualhost is reading through .htaccess files (AllowOverride None directive).
  • Avoid .htaccess file like plague. It is a dynamic configuration file. Relaxation from the configuration (in apache files) is static, constitutes a large difference in performances. But it is unrelated :-)
  • Some directives takes precedences on others, there is a priority in the order of execution. As well as in this documentation link you can observe any Proxy directive is read before any Directory directive (along with a .htaccess is really a sub-sub-sub directory directive). Therefore If your proxy isn't handled with a mod-rewrite P tag in b .htaccess (what an awful idea anyway) it's applied before and odds are your .htaccess isn't read (you're requesting a proxy, there's no local file to see, so Apache doesn't have local directory to see, so apache don't need to parse all existing .htaccess files from the non-existent directory and all sorts of his parents)

On solution, if you're able to edit real configuration files, is by using a redirection within the VirtualHost level, not inside a Directory (or .htaccess) or Location. To ensure that it will likely be always applied:

ErrorDocument 503 /htdocs/err/maintenance.html
## uncomment below to enter maintenance mode
RedirectMatch 503 ^/(?!err/|images/|scripts/)

It's my job to make use of a simplier form with only elements in /err subdirectory, and redirecting everything not within this subdirectory to some 503 error. The 503 will be handled through the maintenance page within this err subdirectory. Here' have added the images/ and scripts/ subdirectories too, didn't test the expression however it should work, I believe.