Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

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 temporarily shut down a web sub-directory and all of its sub-directories without physically removing the files off the server. I want to redirect anyone and everyone to a specific webpage if they try to hit any page inside the sub-directory or its sub-directories. And I want the redirect to go to a page stored in the sub-directory because that's where its css and all its images are located.

I am trying these directives but I am not having success:

Options -ExecCGI -Indexes
DirectoryIndex /sub-dir/interim.php
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !interim.php
RewriteRule ^(.*)$ /sub-dir/interim.php [L,NC,QSA]

Has anyone ever done something like that?

share|improve this question
RedirectMatch ^/$ /sub-dir/interim.php

This will redirect any requests to / to /sub-dir/interim.php

share|improve this answer
Do I need any of the other directives as well -- because it didn't work all by itself. – H. Ferrence Mar 22 '11 at 16:34
Sorry, they don't belong to mod_rewrite, but mod_alias. – derchris Mar 22 '11 at 16:49
Ok. Well that directive didn't do the trick. Thanks anyway. – H. Ferrence Mar 22 '11 at 16:57
How did it not work? Because it is exactly for this purpose. – derchris Mar 22 '11 at 17:12
I tried it 2 ways thinking maybe the sub-dir needed to be defined: RedirectMatch ^/$ /sub-dir/interim.php RedirectMatch ^/sub-dir/$ /sub-dir/interim.php So when I logon to I get the interim.php page (perfect!) But when I logon to I get the actual webpage (I don't want that I want the interim.php page) Then when I logon to I get that actual webpage So it does not achieve my objective -- sorry – H. Ferrence Mar 22 '11 at 17:19

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.