Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What would be the different methods of telling Apache to serve up httpdocs/public instead of httpdocs as the default starting point?

I want to be able to have my includes and logs directories behind the publicly accessible folder.

I know that htaccess is possible, but I've seen a file before that looked something like httpdocs => public ... I could be off, but it was some kind of pointer.

-[public] <-- what's served up to the public
share|improve this question

In your Apache configuration file, find a line with 'DocumentRoot' and modify accordingly.


Regarding your comment, then you're looking for this:

DocumentRoot httpdocs/public/

Though for the virtual-hosts request,

<VirtualHost *:80>
        ServerAdmin webmaster@sitename.com
        ServerName www.sitename.com
        DocumentRoot /var/www/sitename #STILL DOCUMENTROOT!!!
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        <Directory /var/www/sitename/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

        ErrorLog /var/log/apache2/error_sitename.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog /var/log/apache2/access_sitename.log combined


Though note still, it uses the DocumentRoot directive. You can have as many sites as you want. Modify the paths to match the httpdocs/public directory, and I assume that inside /public/ there will be directories for other virtual hosts?

If this isn't what you wanted, please re-phrase your question.

share|improve this answer
No, that's not what I want to do. That would change the entire configuration. I'm talking about a per domain basis. – dcolumbus May 28 '12 at 18:31

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.