サイトリニューアルに際し、エックスサーバー × Wordpress 環境下で301リダイレクトを設定したいのですが、なぜかうまくいきません。皆さんのお力をお貸しください。よろしくお願いします。
実現したいこと
エックスサーバー × Wordpress 環境下で301リダイレクトを設定したい。
試したこと
エックスサーバー機能のサイト転送設定(Redirect permanent)や.htaccessの編集(mod_rewrite)など試しましたが、うまくいきませんでした。 以下は試したコードの一部ではありますが。こちらをpublic_html内の.htaccessに記載。 <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} ^www.xxxx.com$ [OR] RewriteCond %{HTTP_HOST} !=sub.xxxx.com$ RewriteRule /old http://xxxx.com/new [R=301,L] </IfModule>
問題点1
下の階層のリダイレクトがうまくいかない。 http://xxxx.com/old -> http://xxxx.com/new http://xxxx.com/old/old2 -> http://xxxx.com/new としたいが、 http://xxxx.com/old -> http://xxxx.com/new http://xxxx.com/old/old2 -> http://xxxx.com/new/old2 となってしまう。
問題点2
サブドメインはリダイレクトさせたくないが、影響してしまう。 http://xxxx.com/old -> http://xxxx.com/new http://sub.xxxx.com/old -> http://xxxx.com/new となってしまう。
あなたの回答
tips
プレビュー