working with a googleAPIKey and subdomain of localhost
Though all googleAPIKeys work when you run your code at http://localhost or http://localhost/any/sub/directory/, I ran into a bit of a problem with my development server's key once I tried running the site we're developing at http://projectname.localhost/.
It turns out, that Google wanted me to register for an API key for my localhost subdomain.
Now by adding this else if everything is working swimmingly.
-
if ($_SERVER["HTTP_HOST"] == "projectname.dev.naterkane.com"){ //for development server
-
$googleAPIKey = "ABQIAAAAXDA3g3QE28o3DpCEOJaK7RRbiuQmYjiTrMm7iJcFkjKKtES62BTJwMA8r_9--PPf1lirxSLFF7AjoA";
-
} else if ($_SERVER["HTTP_HOST"] = "projectname.localhost"){ //for local development subdomain
-
$googleAPIKey = "ABQIAAAAXDA3g3QE28o3DpCEOJaK7RQd8-PxSvU34sqHMt5i1yPetZP44hRjKyK727DILgg9wBKEDitvz4a0tg";
-
} else { //catchall for "localhost" and default production domain
-
$googleAPIKey = "ABQIAAAAzIcwHNZqp-D2TJm3qjeWyxQjCl-yVJ0Kz7eVNz89X4I7MZtKDxSog71ziTBuu1ICptxfQLN7rq9Xag";
-
}

Add New Comment
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)