将Google App Engine与自己的子域名一起使用

I have created a website which is hosted on Google App Engine, let's say under the url test.appspot.com.

Now I bought my own domain test.com. I added this domain in my Google App Engine Console, changed the DNS preferences of the subdomain www like Google said and can now access my page by via this url. So far, so good.

If I now click a link on my page it redirects me to test.appspot.com/linkedPage.php instead of to test.com/linkedPage.php.

Does anyone know how I can achieve this behaviour? Thanks in advance!

The behavior I wished works as default. I just made a mistake. I used an absolute path in my header statements. Changing them to relative fixed the problem.

Your site will be visible on both appspot.com and test.com.

If you want only the test.com site to be functional you need to install 301 permanent redirect handlers for requests for appspot.com URLs. One approach for achieving this is illustrated in this Q&A.

If you want to keep both sites functional you need all your full path URLs to be dynamically built using the hostname obtained from the request being served. Not sure exactly how you can do this with PHP, tho (I'm a python user). Maybe something like parse_url and/or http_build_query?

Side note: if you keep both sites functional you'll notice you also need some extra care for SEO (due to duplicate content) - it can be addressed using canonical tags, for which again you'll need parsing the URL.