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?

link|improve this question

44% accept rate
feedback

1 Answer

RedirectMatch ^/$ /sub-dir/interim.php

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

link|improve this answer
Do I need any of the other directives as well -- because it didn't work all by itself. – Dr. DOT 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. – Dr. DOT 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 mydomain.com/sub-dir I get the interim.php page (perfect!) But when I logon to mydomain.com/sub-dir/index.html I get the actual webpage (I don't want that I want the interim.php page) Then when I logon to mydomain.com/sub-dir/another-dir I get that actual webpage So it does not achieve my objective -- sorry – Dr. DOT Mar 22 '11 at 17:19
feedback

Your Answer

 
or
required, but never shown

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