Wednesday, June 17, 2009

Configuring local virtual hosts with Apache/XAMPP

Add these to c:/xampp/apache/conf/extra/httpd-vhosts.conf:

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot C:/xampp/htdocs
ServerName localhost

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot path/to/your/project
ServerName yourvirtualhostname

ErrorLog path/to/your/project/error_log
CustomLog path/to/your/project/access_log common

<Directory "path/to/your/project">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all

The second one is your new virtual hosts and the first one guarantees access to non-virtual hosts still work.

You also need to add your new host name to c:/WINDOWS/system32/drivers/etc/hosts: yourvirtualhostname

No comments:

Post a Comment