Wednesday, March 13, 2013

Setting up Virtual Hosts with XAMPP running on Windows 7

The Steps
  1. First I am going to assume you’re using a Windows machine and have XAMPP installed.
  2. Open the XAMPP control panel application and stop Apache. Be aware that late Windows machines might run it as a service, so check the box to the left of the Apache module.
  3. Navigate to C:/xampp/apache/conf/extra or wherever your XAMPP files are located.
  4. Open the file named httpd-vhosts.conf with a text editor.
  5. Around line 19 find # NameVirtualHost *:80 and uncomment or remove the hash.
  6. At the very bottom of the file paste the following code:


    <VirtualHost *:80>
        DocumentRoot "C:/xampp/htdocs"
        ServerName localhost
    </VirtualHost>



  7. Then after that you can copy this code:


    <VirtualHost *:80>
        ServerName zf2-tutorial.localhost
        DocumentRoot "C:/xampp/htdocs/zf2-tutorial/public"
        SetEnv APPLICATION_ENV "development"
        <Directory "C:/xampp/htdocs/zf2-tutorial/public">
            DirectoryIndex index.php
            AllowOverride All
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>