URLの正規化について
HPのURL正規化について質問です。
HPのトップが同じ内容で6種類のURLが存在していました(質問下の詳細を参照)。
これを全て【https://example.jp】へ正規化したいと思っています。
自分で調べながら作業を進めていたのですが
【https://www.example.jp】▶【https://example.jp】
への301転送だけができませんでした。
他のURLについてはすべて【https://example.jp】へ正規化できています。
自分なりに調べてコードを試したのですがうまくいかず....
どこが間違っているのかわからなかったためにご質問させて頂きました。
様々な方法試してみようと思いますので、どなたか教えて頂けないでしょうか。
下記に対象のURL(仮)と現在の《.htaccess》の内容について詳細の書かせて頂いてます。
宜しくお願いたします。
また、このHPは作成当時、WordPressで作成しているみたいで(担当者不明)
もともと《.htaccess》内にWordPress用?のコードも書かれていましたが一回このコード内容は伏せておきます※必要情報であれば、開示致します。
初心者故、わかりにくい説明かもしれませんが何卒、よろしくお願い致します。
対象URL
https://example.jp ◀これに正規化 https://www.example.jp ◀移動できない https://example.jp/index.html ◀完了 https://www.example.jp/index.html ◀完了 https://example.jp/index.php ◀完了 https://www.example.jp/index.php ◀完了
.htaccess コード内容
AddHandler php5-script .php RewriteEngine on RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://example.jp/$1 [R=301,L] Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^www.example.jp/$ RewriteRule ^(.*)$ https://example.jp/$1 [R=301,L] Options +FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} ^.*/index.html RewriteRule ^(.*)index.html$ https://example.jp/$1 [R=301,L] Options +FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ https://example.jp/$1 [R=301,L]
追記:試したコード内容
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.jp/$
RewriteRule ^(.*)$ https://example.jp/$1 [R=301,L]
回答1件
あなたの回答
tips
プレビュー