1
我想重定向我的網站到一個子域,如果從移動客戶端訪問,但.htaccess文件似乎沒有按照我的計劃工作。我認爲這與事實我也重定向非WWW www到htaccess但不知道。任何幫助,將不勝感激!重定向移動網站到子域
<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]