Wednesday, December 30, 2009

Testing Web Applications With a Real URL on local system on Windows

Testing web applications with a real URL on local on windows. Sometimes web apps need to parse the URL and since all real URLS have at least one '.' localhost might not be suitable for testing.



To get around this :



Open the file called hosts its default location is c:\WINDOWS\system32\drivers\etc\hosts or more accurately



%windir%\system32\drivers\etc\hosts

{To get the full path on your system you could type

echo %windir%\system32\drivers\etc\hosts

on a command prompt}



Open it in notepad and add the line at end

127.0.0.1 www.a.com



This is how my file looks


---- start hosts ----

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

 

127.0.0.1       localhost
127.0.0.1       a.com
127.0.0.1       www.a.com

 

 

---- end hosts ----

Now in any browser goto http://a.com/ use this with my XAMPP-PHP-MYSQL set up on local

It maps to local host. Use it as you would use localhost. If your web server is running on a different IP then you can specify that as in

http://a.com:8080



Comments welcome. thank you

Regards

Tushar Kapila

http://sel2in.com

Java, PHP, VB6 Apps. Fight Back pain: Exercise timer application

http://ksoft7.tripod.com/g3.html search page that allows you to search within any website uses google works best in Internet explorer and opera

http://minutes-alarm.sourceforge.net freeware minute alarm, easy reminder for back ache - stand up or meeting ...


Volunteer computer Cancer cures www.worldcommunitygrid.org

Click: www.thehungersite.com , and www.bhookh.com feed hungry , its free. www.ecologyfund.com

Please add these to your start-up how to: http://tusharkapila.blogspot.com/2008/05/s.html 

No comments:

Post a Comment

Followers