マルチドメインで3つのHPを運営しています。
親ドメイン:切り替え式のサイト
子ドメイン:レスポンシブのサイト
子ドメイン:レスポンシブのサイト
親ドメインのみ切り替え式の設定をいれ、子ドメインでは設定なしにしたいと考えています。
しかし自分の書いた内容だと、子ドメインまでリダイレクト処理してしまう設定が入ってしまいうまく書くことができません。
現状スマホでURLの確認をすると下記のようになります。
http://sample/ =>http://sample/s/
http://sample2.jp=>http://sample2.jp/s/sample2.jp/
http://sample3.jp=>http://sample3.jp/s/sample3.jp/
これをスマホで見たとき
http://sample/ =>http://sample/s/
http://sample2.jp=>http://sample2.jp/
http://sample3.jp=>http://sample3.jp/
どのように書けばいいか皆様のご意見よろしくお願いします。
下記がhtaccessの内容です
# This file is made by RewriteRule Tool. # Enable RewriteEngine. RewriteEngine On # Main RewriteRule for multidomain. RewriteCond %{HTTP_HOST} ^(sample2.jp|sample3.jp) RewriteCond %{REQUEST_URI} !^/(sample2.jp|sample3.jp)/ RewriteRule ^(.*)$ /%{HTTP_HOST}/$1/ [L] RewriteCond %{REQUEST_URI} !/(sample.com)/ RewriteCond %{HTTP_USER_AGENT} (iPod|iPhone|iPad|Android|Windows\ Phone) RewriteRule ^(.*)$ s/$1 [R] RewriteBase / RewriteCond %{REQUEST_URI} /(sample.com)/ RewriteCond %{HTTP_USER_AGENT} !(iPod|iPhone|iPad|Android|Windows\ Phone) RewriteRule ^s/(.*)$ $1 [R] RewriteBase / #-------------------------------------------------------------- # sample.com #-------------------------------------------------------------- #URLの正規化(www) RewriteEngine on RewriteCond %{HTTP_HOST} ^www.sample.com RewriteRule (.*) http://sample.com/$1 [R=301,L] #URLの正規化(html,php) Options FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ http://sample.com/$1 [R=301,L] #存在しないページのアクセスをTOPページにリダイレクト[1] ErrorDocument 404 http://sample.com/ #-------------------------------------------------------------- # sample2.jp #-------------------------------------------------------------- #URLの正規化(www) RewriteEngine on RewriteCond %{HTTP_HOST} ^www.sample2.jp RewriteRule (.*) http://sample2.jp/$1 [R=301,L] #URLの正規化(html,php) Options FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ http://sample2.jp/$1 [R=301,L] #-------------------------------------------------------------- # sample3.jp #-------------------------------------------------------------- #URLの正規化(www) RewriteEngine on RewriteCond %{HTTP_HOST} ^www.sample3.jp RewriteRule (.*) http://sample3.jp/$1 [R=301,L] #URLの正規化(html,php) Options FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} ^.*/index.php RewriteRule ^(.*)index.php$ http://sample3.jp/$1 [R=301,L]
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/11/10 00:53