Using mod_rewrite to shutdown website.
Posted
by moolagain
on Server Fault
See other posts from Server Fault
or by moolagain
Published on 2010-05-28T02:29:53Z
Indexed on
2010/05/28
2:33 UTC
Read the original article
Hit count: 268
Hi, I am trying to shutdown a website to everyone except my ip address. I almost have it working. I cannot access www.mysite.com, but I can access all folders that have another .htaccess file in them.
I have a .htaccess file in /www with the following code:
#Use this when website is down
RewriteEngine on
#this allows access through my ip
RewriteCond %{REMOTE_ADDR} !^(66\.777\.888\.99)$
RewriteRule !down.php$ /down.php [L]
Some folders in my site have .htaccess files in them. If I have a file with the line:
RewriteEngine on
I can still access the folder. For example, if I have the second .htaccess file in /www/about, then I can still access mysite.com/about (but the .css file included on that page actually loads down.php).
If I delete "RewriteEngine on" I get redirected to down.php.
Any ideas? I think my mod_rewrite gets confused with multiple .htaccess files.
Thanks!
© Server Fault or respective owner