: Conditional DirectoryIndex based on IP address, using .htaccess I've got this in httpd.conf: <VirtualHost xx.xxx.xx.xxx> Options All +ExecCGI ServerAdmin hostmaster@thehost.com
I've got this in httpd.conf:
<VirtualHost xx.xxx.xx.xxx>
Options All +ExecCGI
ServerAdmin hostmaster@thehost.com
DocumentRoot /var/www/html/domain.com
ServerName dl.domain.org
DirectoryIndex dlindex1.html
</VirtualHost>
... which is fine (what I need as the DirectoryIndex for our 'dl.domain.org' subdomain), but now I also need to alter that DirectoryIndex based on IP address, using .htaccess.
Is this possible?
StackOverflow posts are telling me that I cannot set DirectoryIndex conditionally.. but instead have to use a RewriteRule.
If that is true, OK, but what RewriteCond and RewriteRule?
I am pretty noob in Apache, but anyway have tried many things, including (where the actual IPs are those of our 2 devs):
RewriteCond %{REMOTE_ADDR} ^111.222.333.444$ [OR]
RewriteCond %{REMOTE_ADDR} ^555.666.777.888$
RewriteCond %{SERVER_NAME} ^dl.domain.org
RewriteRule ^(.*)/$ /dlindex2.html
..or even just (as an absolute test):
RewriteCond %{REMOTE_ADDR} ^555.666.777.888$
RewriteRule (.*)/dlindex1.html$ /dlindex2.html
But it seems that whatever I try it just serves up the DirectoryIndex dlindex1.html as per httpd.conf, as opposed to the dlindex2.html I want served up as the default page in that subdomain when a devs IP is calling.
Can any one point me to what I can do to get what I am after? i.e. this: ...to actually, or even just effectively, alter DirectoryIndex based on IP address, using .htaccess, on the fly?
More posts by @Pierce454
1 Comments
Sorted by latest first Latest Oldest Best
Use two subdomains one for the developers which you can make private and secure the other is your live production subdomain
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.