Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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 PUBLIC-IP>
    DocumentRoot /var/www/html/public
    ErrorLog /var/www/logs/error/public
    CustomLog /var/www/logs/access/public common

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.

share|improve this question

1 Answer 1

I am not aware of the solution you are using but it does look solid from here. Clearly I have something new to learn.

I do redirects depending upon IP addresses in .htaccess. I thought I would provide an example if it helps.

RewriteCond %{REMOTE_ADDR} "!^120.0.0.([0-255])$"
RewriteRule mydomain.com/public [R,L]

If this is not right, perhaps it is enough to get you there. You can use it in the httpd.conf or .htaccess files and modify it to your purposes. If your private IP address is not this simple, let me know. I have more complex examples.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.