Tuesday 8 October 2013

How to Make XAMPP/Apache serve file outside of htdocs

    Go to PATH_TO_XAMPP\apache\conf\extra\httpd-vhosts.conf. Open this file and uncomment line 19. You can add your virtual host on line 36.

    <VirtualHost *:80>
        DocumentRoot C:\YOUR_NEW_PATH
        ServerName NEW_SERVER_NAME.localhost
        <Directory C:\YOUR_NEW_PATH>
            Order allow,deny
            Allow from all
        </Directory>
    </VirtualHost>


    Open your drivers hosts file at C:\Windows\System32\drivers\etc\hosts.

    Add

    127.0.0.1 NEW_SERVER_NAME.localhost #NEW_SERVER_NAME

    to the end of the file (before the Spybot - Search & Destroy stuff if you have that installed).

Save this file and Restart Apache and enjoy.