Serving websites outside htdocs in XAMPP

Veeras is a great post, how you can serve your website other than htdocs folder in XAMPP. There were a couple of things that were missing which I should document for myself. I will repeat the whole process as well.

Note that everything here is case sensitive. Example is not same as example

Steps

1. Create a root directory in C:\Blog which is outside xampp\htdocs folder. *Note the capital B*
2. Open [this is my xampp root]\apache\conf\httpd.conf in notepad.

3. Search for this line <Directory “C:/xampp/htdocs”> in httpd.conf. Enter the following code above this line (and above the comments that starts with # signs)


# Note: Blog != blog #
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all

4. Next Search for ScriptAlias /cgi-bin/ "C:/xampp/cgi-bin/" line in the above file. And write this code right below it


Alias /blog/ "C:/Blog/" # Case sensitive!

5. Restart Apache Server in Xampp by going to Start->Apache Friends->XAMPP->XAMPP Control Panel

Now you can type localhost/blog/ and it should take you to the new site.

This is a little bit tricky.
localhost/Blog/ will not work
localhost/blog will not work either but
localhost/blog/ works

So make sure you do every step right. Do not leave any forward slash where it is needed.

Also you may search for part of the strings above to go to the relevent part. With each xampp, thing and shorts change a little bit. This tutorial is current with XAMPP 1.7.7, PHP 5.3.8, year 2012.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*