You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jamie Kahgee <ja...@gmail.com> on 2010/11/01 13:42:21 UTC

[users@httpd] document root

I have a simple server set up on my machine so I can work on multiple sites
- each folder basically represents a site.

my problem is, I now have a new site where I want its document root to be
different than what it currently is. ie: http://localhost/foo  should
actually point to http://localhost/foo/public

I was using Alias /foo /path/to/foo/public/ and this almost seemed to solve
my problems, but now when I include a resource like a style sheet or script
in this new site w/out a full url (/css/main.css), it doesn't reference the
resource in my site, but back to to my current document root - which I do
understand why this happens.

All my old sites use a full URL to any resources, but I don't think this new
one will have that so I need to see if I can make work w/out a full URL

I only have 1 site-enabled right now, which is the default when I set up my
server.  A cut down version looks like this
<VirtualHost *:80>
  ...
  DocumentRoot /var/www/server
  ...
  <Directory /var/www/server/>
    ....
  </Directory>

  Alias /foo /var/www/server/foo/public/
  <Directory /var/www/server/foo/public>
    ...
  </Directory>
  ...
</VirtualHost>

I did try creating another virtual host file for my new site to see if that
would work, but it didn't - My assumption was - it was thinking it was in
the default site not my new one.

Does anyone see what I'm doing wrong or point me in the right direction?
Hopefully I fully explained my problem and used the right terminology.

Thanks,
Jamie K.