: How to see my domain name in URL with Google appEngine I have a domain name : somewhere.com this domain is mapped to somewhere.appspot.com the Google hosting service. Everything works well BUT When
I have a domain name : somewhere.com
this domain is mapped to somewhere.appspot.com
the Google hosting service.
Everything works well
BUT
When the users want to click on a link, they see the link as
somewhere.appspot.com/somepage.php
they get the right page but I would like them to see:
somewhere.com/somepage.php
Any suggestions?
More posts by @Michele947
2 Comments
Sorted by latest first Latest Oldest Best
You can use the HTML base tag in your webpage to make all the relative links point to somewhere.com instead of somewhere.appspot.com.
<base href="http://somewhere.com/">
You can also use the below PHP code to redirect the user to somewhere.com
$host = $_SERVER['HTTP_HOST'];
$request_uri = $_SERVER['REQUEST_URI'];
if(!startsWith($host, 'somewhere.appspot.com')){
header("HTTP/1.1 301 Moved Permanently");
header("Location: somewhere.com .$request_uri);
}
function startsWith($haystack,$needle,$case=true) {
if($case){return (strcmp(substr($haystack, 0, strlen($needle)),$needle)===0);}
return (strcasecmp(substr($haystack, 0, strlen($needle)),$needle)===0);
}
It sounds like you just mapped your domain to your appspot site. You have to set up appspot if you want to use a custom domain.
developers.google.com/appengine/docs/domain
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.