1

I need to redirect all requests to a maintenance page except a specific URL that could still give me the possibility to access the normal website.

I googled but I did not find anything.

Right now I am redirecting with:

RewriteEngine on
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{REQUEST_FILENAME} !/maintenance.html
RewriteRule ^.*$    /maintenance.html [L] 

Normally (because now it is commented out) I am using Tomcat 6 behind Apache with jk_mod:

<IfModule mod_jk.c>
    JkMount / worker1
    JkMount /* worker1
</IfModule>

But how grant the possibility to access the normal website through a specific URL maybe?

elect
  • 203
  • 3
  • 17

1 Answers1

1

1) You could make your rewrite condition to not apply when the request ip address is you.

Such as:

RewriteCond %{REMOTE_ADDR} !^12\.34\.56\.78$ 
RewriteCond %{REMOTE_ADDR} !^87\.65\.43\.21$ 
RewriteCond %{REQUEST_URI} !^sorry\.html 
RewriteRule .* /sorry.html

2) If you don't have a static IP address or anything else uniquely identifiable to you, then another option is to use a VirtualHost with a different port such as 81 where you let the traffic through instead of giving up the maintenance page.

3) If you can't set a different port, or this may be even better anyway, setup a VirtualHost with a different server name using the ServerName directive. You don't even have to set up this name on a DNS server, you can simply add it to your computer's hosts file.

ETL
  • 6,443
  • 1
  • 26
  • 47