Make XAMPP/Apache server file outside of htdocs

  1. Open C:\xampp\apache\conf\extra\httpd-vhosts.conf.
  2. Un-comment line 19 (NameVirtualHost *:80).
  3. Add your virtual host (~line 36):
    <VirtualHost *:80>
        DocumentRoot C:\Projects\rekadia\trunk
        ServerName transitcalculator.localhost
        <DirectoryC:\Projects\rekadia\trunk>
            Order allow,deny
            Allow from all
        </Directory></VirtualHost>
  4. Open your hosts file (C:\Windows\System32\drivers\etc\hosts).
  5. Add
    127.0.0.1 rekadia.localhost #rekadia

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

  6. Save (You might have to save it to the desktop, change the permissions on the old hosts file (right click > properties), and copy the new one into the directory over the old one (or rename the old one) if you are using Vista and have trouble).
  7. Restart Apache.

Now you can access that directory by browsing to http://rekadia.localhost/.

Yosef Sukianto has written 36 articles

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>