LoginSignup
3
0

More than 5 years have passed since last update.

.htaccessで1つ上の階層に301リダイレクトしたい

Last updated at Posted at 2017-10-21

WordPress等で、サーバー移行をした場合、
旧URL http://example1.com/wp/ から
新URL https://example2.com/ へリダイレクトしたい場合は、.htaccessに下記の記述をします。

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(example1.com)(:80)? [NC]
Redirect permanent /wp/ /
RewriteRule ^(.*) https://example2.com/$1 [R=301,L]
</IfModule>
3
0
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
3
0