我有這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
,在飛行中?