Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

share|improve this question
up vote 1 down vote accepted

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.

share|improve this answer
An example of this in action: – ETL Feb 17 '13 at 21:16
Hi ETL, thanks but my ip is dynamic :( – elect Feb 17 '13 at 23:05
The 3) looks genial! I will let you know :) – elect Feb 19 '13 at 9:09
It worked, let me say it again, genial :D, thanks ETL – elect Feb 19 '13 at 16:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.