You need to add
192.168.178.57 site.to.browse
to the hosts file on your android phone, so that it knows that http://site.to.browse/
refers to your server at 192.168.178.57
.
If you want to access your vhost using http://192.168.178.57/site.to.browse
instead, you'll need to do a local URL rewrite on the default vhost that redirects the page request to the desired vhost. So, in the Apache configuration for the default vhost, add
RewriteEngine On
RewriteRule ^/*site\.to\.browse/*(.*)$ http://site.to.browse/$1 [PT,L]
Unfortunately, this causes a discrepancy between the URL the client uses (say, http://192.168.178.57/site.to.browse/some/page.html
) and the one that the server actually serves (http://site.to.browse/some/page.html
). In particular, absolute paths (/some/page.html
) will not be redirected correctly.
You can avoid this by reverse-proxying the internal vhost from the default vhost, using e.g. mod_proxy_html and/or mod_substitute to adjust URLs and paths in the content.
A much more practical approach, for testing, is to put everything interesting in your vhost inside a top folder, so that absolute URLs will only differ by the hostname part. For this, you need
RewriteEngine On
RewriteRule ^/*site\.to\.browse/*(.*)$ http://site.to.browse/site.to.browse/$1 [PT,L]
in the Apache configuration for the default vhost, and
RewriteEngine On
RewriteRule ^/*site\.to\.browse$ /site.to.browse/ [R,L]
RewriteCond %{REQUEST_URI} !^/*site\.to\.browse/
RewriteRule ^/*(.*)$ /site.to.browse/$1 [R,L]
in the vhost configuration; this latter part will redirect any http://site.to.browse/foo
to http://site.to.browse/site.to.browse/foo
, including http://site.to.browse/
to http://site.to.browse/site.to.browse/
.
Obviously, you don't need to use site.to.browse
as the folder name; you could just use e.g. mysite
. The configuration would then be
RewriteEngine On
RewriteRule ^/*mysite/*(.*)$ http://site.to.browse/mysite/$1 [PT,L]
on the default vhost, and
RewriteEngine On
RewriteRule ^/*mysite$ /mysite/ [R,L]
RewriteCond %{REQUEST_URI} !^/*mysite/
RewriteRule ^/*(.*)$ /mysite/$1 [R,L]
in the site.to.browse vhost. The latter will redirect anything not under the mysite folder to under the mysite folder.