xamppvirtual-hosts

virtualhost on xampp and accessible from external device


I'm running XAMPP on my WIN7 laptop for developing websites. Now I use virtualhost and a modified hosts file, so I can access my website "www.thisshouldbemysite.nl" through this URL. But it will be loaded from my XAMPP server.

For me locally, this is working fine. I can do what I want. But I also want to access this server from an external device, e.g. a smartphone or tablet so that I can see how the site is rendered on other devices. But entering the IP address of my XAMPP PC in a tablet browser will bring me to the C:\xampp\htdocs directory and I'm unable to access the C:\xampp\htdocs\thisshouldbemysite.nl directory.

Does anyone has an idea of how I can configure my server to get both working (local and remote). Remote should be in the same local network!

Here you can find my current settings.

hosts:

127.0.0.1 www.thisshouldbemysite.nl

httpd-vhosts.conf:

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

<VirtualHost *:80>
  DocumentRoot C:\xampp\htdocs\thisshouldbemysite.nl
  ServerName www.thisshouldbemysite.nl
</VirtualHost>

Solution

  • Have you tried this configuration for your virtual host?

    <VirtualHost *:80>
      DocumentRoot C:\xampp\htdocs\thisshouldbemysite.nl
      ServerName localhost
    </VirtualHost>