close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Two Domain Names pointing to one site

Thread began 7/29/2010 10:54 pm by dgwhit288523 | Last modified 8/05/2010 8:57 am by Jason Byrnes | 1858 views | 7 replies |

dgwhit288523

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

Sign in to reply to this post

Jason ByrnesWebAssist

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:
<?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>
Sign in to reply to this post

dgwhit288523

Here is the script that I have put on the page

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>

Sign in to reply to this post

Jason ByrnesWebAssist

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.

Sign in to reply to this post

dgwhit288523

Still Confused

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

Sign in to reply to this post

Jason ByrnesWebAssist

the code should be:

php:
<?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.

Sign in to reply to this post

dgwhit288523

Thanks

Hi Jason!

Thanks for sending me the code. The page works fine now!

Don

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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

Content

rating

Layout

rating

Ease of use

rating

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...