The start of a new year, time for a new PC. A new blank canvas to begin installing my stuff. The eternal question - To Xampp or not to Xampp. There are a few things that Xampp does very neatly on Windows, at least as a first-time install, so I decide to go for that rather than try to build my own WAMP stack from scratch. It's easy enough to customise an Xampp install to upgrade the various components as new versions are released, as I described in this article.

I have a preference to install local web files and folders under the User's Documents folder, in my case :

C:/Users/Grant/Web Sites

However, out of the box, Xampp prepares a folder 


for the specific purpose of serving your web files. This may be what you want, in which case you don't have to fiddle with the apache.conf file - just leave the DocumentRoot as : 

DocumentRoot "C:/xampp/htdocs"

and put all your stuff below there.

Say you want to serve your files and folders from a different location - dead easy, just change DocumentRoot to point somewhere else, right ? Yes, but you'll lose all the goodies in your xampp console/dashboard - unless you create an alias that points back to


and even then, it probably won't work as expected.

I want to keep my xampp goodies (such as PHPMyAdmin) but serve most of my stuff from C:/Users/User/Web Sites. The easiest way to do this (I hear the afficionados shouting now) is to create an alias in httpd.conf:

<IfModule alias_module>
# Alias /websites "C:/Users/User/Documents/Web Sites"

This is perfectly acceptable, but sometimes you want the full power of a Virtual Host (vHost), as it is more flexible than just using an alias. Xampp puts vHost directives in


In theory, you could create a vHost for each of your web sites along the lines of :

<VirtualHost *:80>
    ServerAdmin This email address is being protected from spambots. You need JavaScript enabled to view it.
    ServerName websites
    ServerAlias websites
    DocumentRoot 'C:/Users/User/Documents/Web Sites'
    <Directory 'C:/Users/User/Documents/Web Sites'>
      Require all granted
      Options Indexes FollowSymLinks

The problem is, in the Main Configuration, DocumentRoot is set to


and it appears that (at least on Windows), this can't be over-ridden in a vHost, as all DocumentRoot directive are treated as relative paths. When you try the above, although it's syntactically correct, Apache returns a 404 Object Not Found error.

I don't know if there is a workaround for this, or perhaps I'm doing something wrong. I am trying to resurrect my login to ApacheLounge so I can ask the question there, but maybe try StackExchange for now.