I want to change the Apache DocumentRoot setting depending on what IP address is accessing the server. I have added this code to the vhost.conf file but Apache always accepts the last declaration of mydocumentroot and ignores the if statement logic.
<If "%{REMOTE_ADDR} == 91.123.232.226">
Define mydocumentroot /var/www/main-site/
</If>
<Else>
Define mydocumentroot /var/www/holding-page/
</Else>
DocumentRoot ${mydocumentroot}