http://htaccess.cman.jp/explain/redirect.html
リダイレクトには大きく2つの方法がある。
- Redirect
- Redirect ディレクティブは古い URL を新しいものへマップして、 クライアントに新しい場所を訪れるように指し示します。
- RedirectMatch
- Redirect とほとんど同じですが、簡単な先頭からのマッチを行なうのではなく、 正規表現を利用します。
Redirectディレクティブを使う
古いアドレスと新しいアドレスをマッピングして転送する。
利用者はアドレスの変更を気にすることがない
Redirect permanent /shop/ http://example.com/japan/shopping/
RedirectMatchディレクティブを使う
古いアドレスにアクスした場合に、1つの指定したページに転送する
RedirectMatch 301 .* http://example.com/index.html
特定のファイルを転送する
RedirectMatch 301 (.*)\.jpg$ http://example.com$1.jpg RedirectMatch 301 (.*)\.gif$ http://example.com$1.gif
[カテゴリ: ネットワーク]
[通知用URL]
Tweet
最終更新時間:2012年10月07日 21時03分38秒