Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

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.


share|improve this answer

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: http://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);
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.