我有2個網站,一個常規(適用於臺式機),另一個適用於移動設備。它們都具有相同的內容,但手機網站是專爲手機(iPhone手機,黑莓等)移動重定向不適用於Joomla站點
這裏就是我要找:
當用戶到達我的網站在移動設備,然後將上自動重定向到移動版本。在移動版我有一個鏈接,說:「查看完整的HTML」,當他們點擊該鏈接,他們將被髮送到該網站的完整版本,無論他們使用何種設備(臺式機,iPhone或其他)
使用Litespeed網絡服務器。
我無法通過HTACCESS獲得此功能。這裏是我的.htacess是什麼樣子:
Options -Indexes
RewriteEngine On
RewriteBase/
#Added the rule below so that redirecting to the index.php does not operate on the mobile site
RewriteCond %{HTTP_HOST} !^m\.
RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^|&)mobile=1(&|$)
RewriteRule^- [CO=mobile:1:%{HTTP_HOST},S]
# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule^- [CO=mobile:0:%{HTTP_HOST},S]
# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^|&)mobile=0(&|$)
RewriteRule^- [S=1]
# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos" [NC,OR]
RewriteCond %{HTTP:Profile} !^$
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\.
RewriteCond %{QUERY_STRING} !(^|&)mobile=0(&|$)
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP_COOKIE} !\mobile=0(;|$)
# Now redirect to the mobile site
RewriteRule^http://m.mysite.com [R,L]
########## Begin - Rewrite rules to block out some common exploits
## If you experience problems on your site block out the operations listed below
## This attempts to block the most common type of exploit `attempts` to Joomla!
#
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR]
# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [OR]
# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR]
# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR]
# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2})
# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ 404.html [F,L]
#
我嘗試http://www.mysite.com/?mobile=1我一個不會被髮送到移動網站。
這是一個基於Joomla 1.0的網站,我安裝了一個搜索引擎優化組件(sh404sef),不確定它是否會導致問題。 sh404sef將網址轉換爲友善的網址。
可以幫助嗎?