Windows Fake URL test [hosts file]
you can make your application respond with a different behavior based on requested URL, This can be as simple as showing a different logo or as sophisticated as filtering data by that requested domain
this is not such a big implementation problem, but it seems hard to test that is if you don't know how to fake that URL request on your localhost
well
there's a file in this path on a windows environment
%windir%\system32\drivers\etc\hosts
this file contains the definition of the keyword "localhost"
1: # Copyright (c) 1993-1999 Microsoft Corp.
2: #
3: # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
4: #
5: # This file contains the mappings of IP addresses to host names. Each
6: # entry should be kept on an individual line. The IP address should
7: # be placed in the first column followed by the corresponding host name.
8: # The IP address and the host name should be separated by at least one
9: # space.
10: #
11: # Additionally, comments (such as these) may be inserted on individual
12: # lines or following the machine name denoted by a '#' symbol.
13: #
14: # For example:
15: #
16: # 102.54.94.97 rhino.acme.com # source server
17: # 38.25.63.10 x.acme.com # x client host
18:
19: 127.0.0.1 localhost
this is the original contents of the file note in line 19 there's a record that states that 127.0.0.1 (which is the loopback address,, always pointing to your machine) has the alias localhost
so all you need to do to test a URL is add a record that states that the same IP is also your domain,
and also for subdomains you can still do the same, i'd recommend adding the subdomains before the domain itself
like this
1: 127.0.0.1 mail.domain.com
2: 127.0.0.1 user.domain.com
3: 127.0.0.1 www.domain.com
4: 127.0.0.1 domain.com
now when you browse to http://domain.com or http://user.domain.com it'll issue a request to your local Web server and using code you can redirect or display conditional content on the default website
ah.. don't forget to restart your browser after editing and also you need to be an administrator to edit this file