.htaccess 重定向
只是想知道是否有人可以帮助我解决以下问题。
我想将我的网站重定向到子域,whishc 只是显示一个维护页面,允许我在主网站上工作。
因此,我的 .htaccess 代码如下:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$
RewriteRule ^/?$ "http\:\/\/maintenance\.domain\.co\.uk" [R=301,L]
但是,我需要访问根域才能查看我已完成的工作;但是,我只希望自己在我的 IP 上能够查看该内容,并且外部世界被重定向到显示维护页面的子域。
我本以为下面的代码:
RewriteCond %{REMOTE_HOST} !^00\.000\.00\.000
会允许我这样做;但是,我仍然被重定向到子域,我想知道是否有人可以进一步帮助我。
谢谢
Just wondering if someone can help me with the following issue.
I want to redirect my site to a subdomain, whishc simply displays a maintenace page, allowing me to work on the main site.
So I have the following code for my .htaccess:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.co.uk$ [OR]
RewriteCond %{HTTP_HOST} ^www.domain.co.uk$
RewriteRule ^/?$ "http\:\/\/maintenance\.domain\.co\.uk" [R=301,L]
However, I need to access the root domain to be able to view the work that I have done; however, I only want myself on my IP to be able to view that and the outside world is redirected to the subdomain which displays the maintenace page.
I would have thought that the following code:
RewriteCond %{REMOTE_HOST} !^00\.000\.00\.000
Would have allowed me to do that; however, I'm still being redirected to the sub domain and I wondered is someone could assist me further wth this.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信你最好使用
%{REMOTE_ADDR}
:You'd be better of using
%{REMOTE_ADDR}
, I believe: