Developping with googleMaps everywhere with the same licence id

When you want to use google maps on a website, you need to signup and get a key for the internet domain name that will use google Maps.

When your developing your googleMaps feature, it's not on the production site with the final url. (At least... I hope it's not so ;)
And you may code some google feature for several sites, and all these sites, you often code it on your computer with a local Apache/Php or Tomcat server.

So in you html (jsp, php, asp whatever) page you'll include the following code to have access to the google maps feature.

<!-- google map -->
<script type="text/javascript" src=""> </script>

A simple trick, is to request a key for a fake domain here :

Let's say, for "http://toms-projects"

Get the key, put it in your html code, and then edit your etc/hosts file.
(/etc/hosts on linux, c:\windows\system32\drivers\etc\hosts)

and edit the line to       localhost toms-projects

As all system, by default, query the /etc/hosts file before making a DNS query,

toms-projects will be located at by the machine dns client, and thus point to your local website.

And google sees the api key used for the toms-projects domain.

And everything works.

Even better,

you may register directly the final domain key, let's say

and edit you /etc/hosts in the same way :       localhost

It will work as well, but beware, as long as you /etc/hosts file will be configured that way, will be your computer !


Popular posts from this blog

Setting up UPS link with an ubuntu server

Open ssh connection through proxy with NTML authentication

Limit the upload bandwidth of your apache webserver with mod_bw