Redirect public traffic to a different subfolder, while local traffic remains unchanged
- by ecnepsnai
I would like to have local (intranet) HTTP traffic go to the /var/www/html folder while any public traffic goes to the subfolder, /var/www/html/public
I've tried this configuration, with some variation, in httpd.conf
<VirtualHost PRIVATE-IP>
DocumentRoot /var/www/html
ServerName ecn
ErrorLog /var/www/logs/error/private
CustomLog /var/www/logs/access/private common
</VirtualHost>
<VirtualHost PUBLIC-IP>
DocumentRoot /var/www/html/public
ServerName PUBLIC-DOMAIN-NAME
ErrorLog /var/www/logs/error/public
CustomLog /var/www/logs/access/public common
</VirtualHost>
PUBLIC-IP, PRIVATE-IP, and PUBLIC-DOMAIN name are all replaced with the correct values in the actual document.
The problem is, local traffic can browse fine but remote traffic is directed to the root folder and getting 403d (because I have that folder blocked off through my .htaccess file). If I append /public to the URL it works fine.