我试图建立一个htaccess的重定向为每个人除了我。它工作得很好......只是我必须写一个例外每一个正在建设中的页面想要的文件。这将带我一段时间,我敢肯定有一个适当的方式做到这一点,我只是不能找到它。
我已经试过这样:
为了否认,允许
所有否认
允许从205.97.194.334
ErrorDocument的403 http://www.domain.com/page.htm
<文件page.htm>
允许所有
< /文件>
不过,我得到一个内部服务器错误
我现在是这样的:
RewriteEngine叙述上
的RewriteBase /
的RewriteCond%{} REMOTE_HOST!^ 127 .0 .0 .1
的RewriteCond%{REQUEST_URI}!/我的空间 html的$
重写规则。* http://www.domain.com/construct/mypage.html [R = 302,L]
我能加入这让一切都在/结构/#?
三江源
P.S。谁能告诉我,为什么第一次尝试没有工作?
编辑:
好,我补充这一点,这使得该文件,但是,它是进入该目录时,只重定向。即domain.com重定向到建设网页,但domain.com/index.php和其他任何不会重定向
#重定向大家谁不是从你的IP
的RewriteCond%{REMOTE_ADDR}!00.00.00.00 [NC]
#允许送达真正的文件
的RewriteCond%{} REQUEST_FILENAME!-f
重写规则!index.html的$ http://subverb.net/construct/index.html [R = 307,L]
解决方案
如果你想 /构建
来可为每个人,然后你想打开任何其他的URL时,他们被重定向到URL:
#如果不从您的地址
的RewriteCond%{REMOTE_ADDR}!^ 123 0.4 0.5 0.6 $
#而不是/构建目录
的RewriteCond%{REQUEST_URI}!^ /构造
#THEN孙中山他们/construct/index.html
重写规则(。*)/construct/index.html [R = 307,L]
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]
相关推荐
最新文章