HTTPリダイレクトにはいくつか種類があります。

301 Moved Permanently

Permanently(永久に)移動する時使います
SEO的には転送『先』のURLをインデックスして欲しい時

PHPでの書き方

header('Location: http://example.com/', TRUE, 301);

.htaccessでの書き方

Redirect permanent / http://example.com/

metaタグでの書き方

<meta http-equiv="Refresh" content="0; URL=http://example.com/">

302 Found(Moved Temporary)

Temporary(一時的に)移動する時使います
SEO的には転送『元』のURLをインデックスして欲しい時

PHPでの書き方

header('Location: http://example.com/');
header('Location: http://example.com/', TRUE, 302);

.htaccessでの書き方

Redirect temp / http://example.com/

metaタグでの書き方

Yahoo!は0以外であれば302扱いだが、Googleはダメらしい

<meta http-equiv="Refresh" content="1; URL=http://example.com/">

metaタグでの記述は携帯電話では認識しない問題などがあるのでオススメしません。


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2021-09-19 (日) 19:09:23