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

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.

| 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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