Website URL redirection is used in several instances. For example:

  • When the domain is reallocated from to Because people will still keep, instead of the new one for the website in their bookmark.
  • When the webpage is renamed or reallocated.
  • When you expect different content for different locations of your user population. An airline website for instance; the default “from” location for a ticket would be Chicago if the user IP is from Chicago, etc.

Testing redirection in a live environment is simple. Just type in the domain alias in the address bar, and then check the final response. But what about the test environment? In the testing phase, the site to be tested isn’t open yet, so the public DNS won’t contain the mapping information of the domain. That means you can’t directly test like you would in a live site. In this instance, we, as testers, must configure “Hosts” file to  map the testing server IP and the domain for test environment setup.

One popular application of redirection — deliver webpages with user-oriented content based on their locations — needs geographic IP simulation for test execution. In this case, a VPN can implement IP spoofing, but can only provide a limited number of IP for different cities/countries. This won’t do if you have 40 cities/countries on your testing list, or require an IP of a location that the VPN can’t provide. In this case, we can use “curl” with geographic IP for as many as you need. (curl: a command line tool for transferring data with URL syntax).  To get the IP for different locations, you can use To look up what the location is, given an IP, you may check out: