我创建了一个 .htaccess 文件来将特定 IP 地址重定向到另一个文件:
# Allow rewriting of htaccess
RewriteEngine On
RewriteBase /
# Get remote address/block of addresses to redirect
RewriteCond %{REMOTE_ADDR} 127\.0\.0\.1
# Define the file being accessed
RewriteCond %{REQUEST_URI} /index\.php$
# When the remote address(es) try to access the file above redirect them to the file below
RewriteRule .* /other-index\.php [R,L]
如果它尝试访问 index.php 但允许所有其他远程主机访问 index.php,则这很好,上面将 localhost 重定向到 other-index.php。
远程主机正在调用:http ://www.example.com/index.php
我的问题是远程主机(在本例中为 localhost)能否发现它正在被服务器重定向?