如果从移动客户端访问,我正在尝试将我的网站重定向到子域,但 .htaccess 文件似乎没有按我的计划工作。我认为这与我也在 htaccess 中将非 www 重定向到 www 但不确定的事实有关。任何帮助,将不胜感激!
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mysite.com
RewriteRule (.*) http://www.mysite.com/$1 [R=301,L]
RewriteEngine On
RewriteCond $1 !^(?:static|install)(?:/.*)?$
RewriteRule ^(.*)$ index.php?ORIGINAL_URI=$1 [QSA]
</IfModule>
Options +FollowSymlinks
RewriteEngine on
RewriteBase /
# prevent looping
RewriteCond %{HTTP_HOST} !^m.mysite.com$
# if the browser accepts these mime-types, it's definitely mobile, or pretending to be
RewriteCond %{HTTP_ACCEPT} "text\/vnd\.wap\.wml|application\/vnd\.wap\.xhtml\+xml" [NC,OR]
# a bunch of user agent tests
RewriteCond %{HTTP_USER_AGENT} "sony|symbian|nokia|samsung|mobile|windows ce|epoc|opera" [NC,OR]
RewriteCond %{HTTP_USER_AGENT} "mini|nitro|j2me|midp-|cldc-|netfront|mot|up\.browser|up\.link|audiovox"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "blackberry|ericsson,|panasonic|philips|sanyo|sharp|sie-"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "portalmmm|blazer|avantgo|danger|palm|series60|palmsource|pocketpc"[NC,OR]
RewriteCond %{HTTP_USER_AGENT} "smartphone|rover|ipaq|au-mic,|alcatel|ericy|vodafone\/|wap1\.|wap2\.|iPhone|android"[NC]
# rewrite rules here
RewriteRule ^(.+)\$ http://m.mysite.com/$1 [R=302,NC]