开发者

htaccess redirect - allow files for construction page

I've tried to set up a htaccess redirect for everyone except me. 开发者_运维问答It works fine...except that I have to write an exception for every file that the under construction page wants. This will take me a while and I'm certain there is a proper way to do it, I just cant find it.

I have tried this:

order deny,allow
deny from all
allow from 205.97.194.334
ErrorDocument 403 http://www.domain.com/page.htm

<Files page.htm>
allow from all
</Files>

But I get an internal server error

What I have now is this:

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^127\.0\.0\.1

RewriteCond %{REQUEST_URI} !/mypage\.html$  

RewriteRule .* http://www.domain.com/construct/mypage.html [R=302,L]

What can I add in this to allow everything in the /construct/ ?#

Thankyou

P.S. Can anyone tell me why the first attempt didn't work?

EDIT:

Ok I've added this, which allowed the files, however, it is only redirecting when the directory is entered. I.e. domain.com will redirect to the construction page, but domain.com/index.php and anything else will not redirect

# Redirect everyone who's not from your IP
RewriteCond %{REMOTE_ADDR} !00.00.00.00 [NC]
# Allow real files to be served
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule !index.html$ http://subverb.net/construct/index.html [R=307,L]


If you want /construct to be available to everyone else, and you want them to be redirected to that URL when opening any other URL:

# IF not from your address
RewriteCond %{REMOTE_ADDR} !^123\.4\.5\.6$

# AND not for /construct directory
RewriteCond %{REQUEST_URI} !^/construct

# THEN sen them to /construct/index.html
RewriteRule (.*) /construct/index.html [R=307,L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜