这与以下问题有关:
conditional DirectoryIndex in .htaccess
答案指出以下应该有效:
SetEnvIf Remote_Addr ^127\.0\.0\.0$ owner
<IfDefine owner>
DirectoryIndex index.html
</IfDefine>
<IfDefine !owner>
DirectoryIndex index.php
</IfDefine>
我不确定这是否有效,Env var 的设置确实有效,但无论我从哪个 IP 访问 DirectoryIndex 的站点始终是 index.php
条件语句有问题还是我应该使用其他东西?
提前致谢
最佳答案
我最终使用以下方法来实现我想要的
DirectoryIndex index.html
RewriteCond %{REMOTE_ADDR} ^my\.ip\.000\.000$
RewriteRule ^index.html$ index.php
谢谢!
关于php - Htaccess 中的条件目录索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2296477/