I just un-installed XAMPP and decided to take into use the Apache included within OS X. After a lot of fiddling around I've gotten it to somewhat work, but not quite.

I use VirtualHostX for managing vhosts to my local projects. When I add a vhost (e.g. project.dev -> htdocs/Project) using the app, that vhost will work properly.

However, when I try to access localhost, things get weird. Let's say I navigate to localhost/foo on my browser. It gives 404, and this can be found in the error-logs:

[error] [client] File does not exist: /path/to/htdocs/Project/foo

So, basically it seems that the first vhost I have set up defines the folder where localhost/* tries to look for files.

Any ideas? It is very possible I've messed up some configuration by either using XAMPP or VirtualHostX.

2 Answers 2


You also need to set the main document root in the http.conf file. Otherwise Apache will use the first vhost avaible.

  • It is set to the appropriate path: DocumentRoot "/same/path/to/htdocs". Also the appropriate <Directory>-tag is edited properly. Jun 8, 2013 at 11:04
  • Maybe post a (censored) version of your conf file.
    – ChrisG
    Jun 8, 2013 at 11:05
  • What portions do you think would be most useful? The whole file is pretty long. I can copy the parts that would help. Jun 8, 2013 at 12:19
  • Where you define the vhost and document root,
    – ChrisG
    Jun 8, 2013 at 16:27

You need to set up a localhost vhost. Once you enable virtual hosting, Apache uses the first vhost if no vhost match, as outlined in the documentation: http://httpd.apache.org/docs/current/en/vhosts/name-based.html.

  • I've tried using VirtualHostX to set a vhost like this: localhost -> /path/to/htdocs, but I get error 403 Forbidden. Here's an example of the lines that show up in logs (when requesting localhost/foo): [error] [client ::1] mod_hfs_apple: Mis-cased URI: /path/to/htdocs/foo, wants: /path/to/htdocs/ Jun 8, 2013 at 18:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .