views:

361

answers:

2

I am trying to test Google Maps in development sites under IIS. My local testing URL is http://sitename/. As there is no “.com” in the name, I cannot obtain an API key. I can obtain a key for http://localhost/, but I am wondering if there is a way to use the testing URL http://sitename/.

+1  A: 

While I don't know Google Maps' API details, you can locally alias a *.com domain to your own local server. Add an entry to /etc/hosts (the equivalent on Windows is c:/windows/system32/etc/hosts, IIRC).

For example, you could add:

127.0.0.1   localhost.yourotherdomain.com
# or
127.0.0.1   localtest.yourotherdomain.com
Roger Pate
Great response. After posting, this dawned on me. Although I’ve not tried it, it should work. Thanks!
shxo
+2  A: 

This was a fluke. For some reason, the key register page would not allow me to register the domain. After posting this question, I tried again and it gave me the key.

To use Google maps on a testing server, just register for the key with the testing name http://sitename/. This will also work for /localhost/.

shxo