我有这httpd.conf
:有条件的DirectoryIndex基于IP地址,使用的.htaccess
<VirtualHost xx.xxx.xx.xxx>
Options All +ExecCGI
ServerAdmin [email protected]
DocumentRoot /var/www/html/domain.com
ServerName dl.domain.org
DirectoryIndex dlindex1.html
</VirtualHost>
...这是很好的(我需要什么作为DirectoryIndex
我们“dl.domain.org”子域),但是现在我还需要根据IP地址改变DirectoryIndex
,使用.htaccess
。 这可能吗?
其他SO帖子告诉我,我不能设置DirectoryIndex
有条件..而是有使用RewriteRule
。 如果是这样,确定,但RewriteCond
和RewriteRule
? 我在Apache的漂亮的小白,但无论如何,已经尝试了许多东西,包括(其中实际IP是那些我们的开发者2的):
RewriteCond %{REMOTE_ADDR} ^111\.222\.333\.444$ [OR]
RewriteCond %{REMOTE_ADDR} ^555\.666\.777\.888$
RewriteCond %{SERVER_NAME} ^dl.domain.org
RewriteRule ^(.*)/$ $1/dlindex2.html
..或者甚至只是(作为一个绝对的测试):
RewriteCond %{REMOTE_ADDR} ^555\.666\.777\.888$
RewriteRule (.*)/dlindex1.html$ $1/dlindex2.html
但似乎无论我尝试它只是提供了DirectoryIndex dlindex1.html
按httpd.conf
,而不是在dlindex2.html
我想担任了作为默认页面在子域,当开发者IP呼吁。
任何人都可以指出我能做些什么来获得我所追求的东西吗?即:...实际上或甚至仅仅是有效地基于IP地址改变DirectoryIndex
,使用.htaccess
,在飞行中?