実現したいこと
- サブドメインの特定記事からルートドメインの特定記事にリダイレクト
- それを複数実現したい
下記のとおり、複数ページをリダイレクトしたい場合の「正しい書き方」を教えていただけませんでしょうか?
- sub.example.com/article-a/ → example.com/article-a/
- sub.example.com/article-b/ → example.com/article-b/
- sub.example.com/article-c/ → example.com/article-c/
補足情報
- レンタルサーバー → エックスサーバー
- CMS → WordPress
サブドメインのリダイレクトはサーバーパネルではなく、ファイルマネージャーの.htaccessに記述するようです。
試したこと:これだと500エラーを吐く
# BEGIN リダイレクト RewriteEngine On RewriteCond %{HTTP_HOST} ^sub\.example\.com\article-a\$ RewriteRule ^(.*) https://example.com/article-a/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^sub\.example\.com\article-b\$ RewriteRule ^(.*) https://example.com/article-b/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^sub\.example\.com\article-a\$ RewriteRule ^(.*) https://example.com/article-a/$1 [R=301,L] # END リダイレクト
複数ページをリダイレクトする場合の「正しい書き方」を教えてください。
エラーが怖いです。。。

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2023/11/25 04:17 編集