Results 1 to 2 of 2
  1. #1

    Apache Virtual Host Mapping to the Wrong Directory

    Hello Again ... My last post was so successful, I figured I would give this another shot.

    I am running an Apache service on CentOS. Apache is more or less a base install using Yum. I have, however, enabled virtual hosting by uncommenting:

    NameVirtualHost *:80

    Now, it seems to be working ... kinda. The virtual host is picking up, and pointing me 'almost' to the correct directory, but unfortunately it points one directory higher than it is supposed to ... not at all sure why.

    Here is my Virtual Host Definition:
    <VirtualHost *:80>
      ServerAlias *
      ServerAdmin [email protected]
      ErrorLog /var/log/httpd/
      CustomLog /var/log/httpd/ combined
      DocumentRoot /var/www/html/
      <Directory "/var/www/html/">
        DirectoryIndex index.php
        Order allow,deny
        Allow from all
    As you can see, I am trying to put the user in the /htdocs directory, but it points me to the directory just above it.

    Everything from the directory and down is recursively owned by apache:apache. Whats worse, if I manually go to <domain>/htdocs/index.php, I get nothing.

    Also, the error-log repeats this a lot:

    Directory index forbidden by Options directive: /var/www/html/

    I have tried several things ... trailing slash at the end of the directory, fiddling with the <directory> section, removing the <directory> section ... just don't know. It is probably something stupid, as it usually is, but I am not a server guy and just don't see it.

    Thanks again for looking ...

  2. #2
    Join Date
    Mar 2009
    Austin Tx
    What files do you have in ....../htdocs target folder? You mentioned an index.php, is there anything in it?

    "Directory index forbidden..." means you are not hitting a default index for whatever, and instead of displaying an index of files, your Options directive for that folder don't allow it.

    It really looks like nothing in in the / directory (or no index file at least). Starting to think you may have conflicting Virtualhost entries? Is there another in the conf file?

    You can override and see if you get a directory index with this - go back up the conf file and find your global docroot and it's Dir Options directive:

    <Directory "/var/www/html">
    Options Indexes FollowSymLinks MultiViews

    If you have to, you can add that Options directive line to your show existing <directory> entry for that vhost, just to test. Not a good practice to allow dir indexing by default, though.
    This is the best signature in the world....Tribute!
    (It is not the best signature in the world, no. This is just a tribute)

Similar Threads

  1. Replies: 5
    Last Post: 03-20-2007, 12:01 PM
  2. Apache virtual name host help
    By MankeyMonkey in forum Web Hosting
    Replies: 4
    Last Post: 08-14-2005, 07:32 PM
  3. Mapping DNS to Apache
    By EstSolarus in forum Web Hosting
    Replies: 8
    Last Post: 03-01-2005, 02:40 PM
  4. (PHP) Mapping the files in a directory
    By fozzy in forum Programming Discussion
    Replies: 6
    Last Post: 09-01-2004, 11:03 AM
  5. Wrong Apache Root for Shared Host
    By Mans in forum Hosting Security and Technology
    Replies: 3
    Last Post: 09-17-2003, 02:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts