.htaccess 重定向到除我之外的所有 IP [英] .htaccess redirect to all IP's but mine

查看:34
本文介绍了.htaccess 重定向到除我之外的所有 IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我正在尝试在网站的前端工作,但如果您愿意,我希望除我自己以外的其他所有人都被重定向到构建页面.我目前有:

Basically, I am trying to work on the front end of a website, but I would like everyone else but myself to be redirected to a construction page if you like. I currently have:

redirect 301 /index.php http://www.domain.com/construction.php

虽然这有效,但效果很好,我希望自己仍然能够看到实时站点,是否可以排除除我的 IP 之外的所有人?

While this works, it works to well, I would like to be able to still see the live site myself, is it possible to exclude everyone but my IP?

再次感谢.

推荐答案

你可以用 mod_rewrite 做到这一点

You could do it with mod_rewrite

Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !=123.45.67.89
RewriteRule index.php$ /construction.php [R=301,L]

这篇关于.htaccess 重定向到除我之外的所有 IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆