たとえば、 example.com(ネイキッドドメイン、タイプA) www.example.com(ghs.googlehosted.com、タイプCNAME) 、あなたは301リダイレクトしたいwww .example.comからexample.comへフォローは、それが動作しませんredirect.phpGoogle App Engine 301 PHPでリダイレクト
> <?
> $direct_redirects = array("www.example.com" => "http://example.com",);
>
> $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
> $redirect_url = $direct_redirects[$path];
if(!is_null($redirect_url)) {
> header("HTTP/1.1 301 Moved Permanently");
> header("Location: $redirect_url"); }
app.yamlを
handlers:
- url: /.*
script: redirect.php
- url: /(.*)
static_files: index.html
upload: index.html
です。
あなたはPHPでGAEで301のリダイレクトをしますか?
'header(" Location:$ redirect_url ");' –
@Irfanの後にexitを使います。全く私は間違っていた。これは 'path'リダイレクトだけで、 'host url'ではありません。ありがとう。私はこの問題を解決しました。 – Danny
どうやってこれを解決しましたか?私は同様の問題に直面している。しかし、私のアプリはNodeにあります。 yamlまたはサーバのルーティングだけで書く必要がありますか?あなたが助けることができたら – anshulix