Two Domain Names pointing to one site
I have two domains pointing to one site with a single directions.htm page. One API key will not work for both domains. Please advise the solution to this.
Thanks,
Don
I have two domains pointing to one site with a single directions.htm page. One API key will not work for both domains. Please advise the solution to this.
Thanks,
Don
on your page, you will see a script line that looks like:
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAvZMU4-DFRYtw1UlTj_zc6hT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQcT1h-VA8wQL5JBdsM5JWeJpukvw">/*wagmp*/</script>
this is the line that passes the api key.
you would need to create a php statement to determine which api key should be used based on the $_SERVER["HTTP_HOST"]
<?php
switch ($_SERVER["HTTP_HOST"]) {
case "www.domain1.com":
$key = "key for domain 1";
break;
case "www.domain2.com":
$key = "key for domain 2";
break;
default:
$key = "key for domain 1";
break;
}
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $key; ?>">/*wagmp*/</script>
I am still getting error using this code - searaysundancer370.com You can view the source code on this page.
Where have I made the error?
Thanks,
Don
<script type="text/javascript" src="google_javascript/wagmp_map_1.js">/*wagmp*/</script>
<?php
switch ($_SERVER["HTTP_HOST"]) {
case "www.searaysundancer370.com":
$key = "ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBS4ZVxhru6LkDaeeOoNxAQuLVGqbxRZ7MIad5ZJjxL82oxdSH3m3LJ3uQ";
break;
case "www.94searaysundancer370.com":
$key = "ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBToqOJDWkzYAxl4kqVz88eMNB2R6xSNBMF6R1rxfnb3YZBo47b
QXUDp7g";
break;
default:
$key = "ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBS4ZVxhru6LkDaeeOoNxAQuLVGqbxRZ7MIad5ZJjxL82oxdSH3m3LJ3uQ";
break;
}
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $key; ?>">/*wagmp*/</script>
your page is a static html page, you cannot process PHP code on a static html page, rename the page using the .php extesnion:
directions.php
this assumes that your hosting plan includes php scripting.
I have two domains pointing to the one directions page which I have renamed to a .php page.
The keys for the two domains are as follows:
searaysundancer370.com :ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBS4ZVxhru6LkDaeeOoNxAQuLVGqbxRZ7MIad5ZJjxL82oxdSH3m3LJ3uQ
94searaysundancer370.com: ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBToqOJDWkzYAxl4kqVz88eMNB2R6xSNBMF6R1rxfnb3YZBo47bQXUDp7g
The primary key on which the htm page works is the first one.
The directions.htm page works fine with the following code for the searaysundancer370.com page.
<script type="text/javascript" src="google_javascript/wagmp_map_1.js">/*wagmp*/</script>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBS4ZVxhru6LkDaeeOoNxAQuLVGqbxRZ7MIad5ZJjxL82oxdSH3m3LJ3uQ">/*wagmp*/</script>
What should the new page renamed .php look like codewise using the two keys?
I am a real newbie at this and apologize for asking for some more help with this.
Thanks,
Don
the code should be:
<?php
switch ($_SERVER["HTTP_HOST"]) {
case "searaysundancer370.com":
$key = "ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBS4ZVxhru6LkDaeeOoNxAQuLVGqbxRZ7MIad5ZJjxL82oxdSH3m3LJ3uQ";
break;
case "94searaysundancer370.com":
$key = "ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBToqOJDWkzYAxl4kqVz88eMNB2R6xSNBMF6R1rxfnb3YZBo47bQXUDp7g";
break;
default:
$key = "ABQIAAAAgwtnfPNsBdEuoMiz7NZqoBS4ZVxhru6LkDaeeOoNxAQuLVGqbxRZ7MIad5ZJjxL82oxdSH3m3LJ3uQ";
break;
}
?>
<script type="text/javascript" src="http://maps.google.com/maps?file=api&v=2&key=<?php echo $key; ?>">/*wagmp*/</script>
but for this code to work, your pages will need to be saved as PHP pages.
Hi Jason!
Thanks for sending me the code. The page works fine now!
Don
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.