How can I access Apache name based vhosts from different device on my LAN?

I have Apache 2.2 setup with name based virtual hosts on my development computer but I want to access them from my phone/tablet.

Apache is running on my main computer at Each local website is stored under htdocs like:

If I type into the browser on my tablet I get a Not Found error message: “The requested URL / was not found on this server.”
In the Apache error.log it says:

[error] [client] File does not exist: C:/Apache2/htdocs/

My Apache httpd-vhosts.conf is setup like:

NameVirtualHost *:80

<VirtualHost *:80>
   UseCanonicalName Off
   VirtualDocumentRoot "c:/Apache2/htdocs/%0"
   VirtualScriptAlias "c:/Apache2/%0/cgi-bin"

Is it possible for me to access from my tablet? It’s not rooted, so I can’t edit the Android hosts file.


Sorry, it’s not clear here - but did you try “”?

Yeah, it just gives the Not Found error page saying:

The requested URL / was not found on this server.

But the error log entry still only says:

[error] [client] File does not exist: C:/Apache2/htdocs/

If I create the folder in htdocs called “” and put an index file in it then that IS displayed in the tablet.
So I guess the problem is due to the VirtualDocumentRoot directive… but is the only way to get around that editing the Andorids hosts file? Or is there a way to get around it using only Apache?

If memory serves, that %0 is a reference to the incoming servername - that’s why it’s constantly adding that IP to the end. If that’s true, you might be able to access your sites with ( ) by removing that %0 and restarting apache.

However, this depends largely on your goals. How are you wanting to access the sites? Does it matter to you?

NameVirtualHost *:80
<VirtualHost *:80>
   UseCanonicalName Off
   VirtualDocumentRoot "c:/Apache2/htdocs"
   VirtualScriptAlias "c:/Apache2/cgi-bin"

This looks like a bit out of a setup that would process different vhosts, but not a complete arrangement. If all you want is to access them via / then you may not need that.

I’m not an expert on Apache virtualhosts, by any means, might just wait for a better answer. In the meantime, try it without the %0 for kicks?

Edit: I can’t see why you’d need the android host file changed… this should be solvable in Apache config somehow.

I’m using mod_vhost_alias to do “dynamically configured mass virtual hosting” so that “adding virtual hosts is simply a matter of creating the appropriate directories in the filesystem and entries in the DNS - no need to reconfigure or restart Apache”.

Removing the %0 makes it work from the tablet with
But then I have to also specify the IP to access it from the main computer running Apache e.g.
But having to include the IP makes the sites not work properly with my front controller and/or PHP stuff.

On my computer running Apache I edit the hosts file to point all my development sites to The simple solution would be to edit the hosts file on my phone/tablet so that requests from them to etc are sent to
Could it be done in my router somehow…?

I see what you’re saying… without the time to do research (at work) I’m at a loss for what you’d want to do though… if it’s not answered this evening I might take a look and see if I can find out anything helpful. Always nice to learn more about Apache and Nginx. They’re the bane of development existence while at the same time being the house we live in… kinda… heh.

On your remote device, add the virtual host to your hosts file using the IP address and the virtual host name. On the hosting computer, add it to your hosts file, too. What you need to do is simulate DNS settings to gain access to the file.