1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

サイト移転などの際に使える.htaccessによる301リダイレクト

Last updated at Posted at 2015-02-08

今回はhtmlにwordpressを組み込みました。
その際に使用したもの。

■zirei○○.htmlをzireiにリダイレクト

 html版からwordpress版などに移行した際に使えます。

RedirectMatch permanent /zirei(.*).html /zirei

<解説>
. : 何でもいい1文字

  • : 直前の文字が0個以上繰り返されることを示す

→ .* : どんな文字列も対象

■. ○○.html をルートディレクトリにリダイレクト

RedirectMatch permanent (.*).html $1/

<解説>
 (hoge) : hogeを$1の引数として渡す
 → $1 = hogeとなります。

【追記】

Redirect と RedirectMatchの違いは
正規表現が使えるかどうか。

Rediret : 正規表現使用不可
RedirectMatch : 正規表現使用可

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?