close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


one map api, multiple domains

Thread began 12/13/2009 3:42 pm by florianmagener266546 | Last modified 12/25/2009 6:25 pm by joe396415 | 3350 views | 4 replies |


one map api, multiple domains

is it possible to have one google map api for various domain names that are directed to one domain or to embed the different google map api's ( for each domain name) in the same page under one domain?
At present if I type in a browser one domain name I get the error that it is the wrong api for that domain as it is being redirected to a different domain.

Please advise?

Sign in to reply to this post

Jimmy Wu

If you want to use the same map over again for different domains, you will have to get a different api key for each of the domains you are using it for.

If you are uploading the same pages to different domains, you will have to change the api key accordingly. On the page you have the map applied, find the map script that looks similar to this:
<script type="text/javascript" src="">/*wagmp*/</script>

The key= portion stores the api key that is used. Replace that with the correct api key for each domain.

Sign in to reply to this post

Brad Lawryk

Hi Jimmy,

I don't think that is what the original poster meant. I am having the same issue as the original poster:

I have two domain names for example and both bring up the same website but the google map will only work for one of them.

Is there a work around this?


Sign in to reply to this post

Jason ByrnesWebAssist

you can find the currant servers domain name using the HTTP_HOST server variable:

<?php echo((isset($_SERVER["HTTP_HOST"]))?$_SERVER["HTTP_HOST"]:""?>

Create a switch statement to select which key should be used based on that variable:


switch ($_SERVER["HTTP_HOST"]) {
""$key "key1"; break;
""$key "key2"; break;
""$key "key2"; break;
$key "default key"; break;  

then change the script tag that connects to the google api to use the new $key variable:

<script type="text/javascript"  src="<?php echo $key?>">/*wagmp*/</script>
Sign in to reply to this post


Cool...I had this exact problem and this fix worked well!


Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question





Ease of use


security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...