・条件A:
スマホでPC版ページにアクセスしたときにスマホ版の該当するページに301リダイレクトする。
/abc/front/index.htmlから/s/abc/index.html (階層そのままsディレクトリ以下に移すわけではない。frontディレクトリが抜けている)
/def/front/index.htmlから/s/def/index.html
/ghi/front/index.htmlから/s/aghi/index.html
・条件B:
PCでスマホ版ページにアクセスしたときにスマホ版の該当するページに301リダイレクトする。
つまり、上記の逆。
これらを実現する.htaccessを教えて下さい。
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} (iPhone|iPod|Android|BlackBerry|Windows.Phone) [NC] RewriteCond %{HTTP_USER_AGENT} !iPad [NC] RewriteRule ^(.*)$ /s/$1 [R=301,L]
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} (iPhone|iPod|Android|BlackBerry|Windows.Phone) [NC] RewriteCond %{HTTP_USER_AGENT} !iPad [NC] RewriteRule ^\/s\/(.*)$ $1 [R=301,L]