PDA

View Full Version : [all variants] Combining two security directives in Apache



woland
May 18th, 2008, 12:46 PM
Hi!

I want to secure a directory in Apache in the following manner:
I want password and username to be required, except for users accessing from the company's IP address.

Is it possible to combine two security directives for a directory and if so, how do I do it?

Thanks in advance.

solcott
May 18th, 2008, 03:14 PM
This is sort of a hackjob-ish way of accomplishing this, but this should work.

The paths here are examples, just to demonstrate the theory.

Put your content someplace like:
/var/www/somehost/thecontent

Then, symlink something like
/var/www/somehost/internalaccess/content to /var/www/somehost/thecontent
and
/var/www/somehost/externalaccess/content to /var/www/somehost/thecontent

Set up virtual hosts to get their content from the external and internal symlinks /var/www/somehost/internalaccess/ and /var/www/somehost/externalaccess/ and then .htaccess the internal one to only allow from internal IP's, and the external vhost to require a password.