Mobile app version of vmapp.org
Login or Join
Michele947

: 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

@Michele947

Posted in: #Domains #GoogleAppEngine #Url

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?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Michele947

2 Comments

Sorted by latest first Latest Oldest Best

 

@Shakeerah822

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);
}

10% popularity Vote Up Vote Down


 

@Murphy175

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

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme