私は 2 つの Web サイトを持っています。1 つは通常 (デスクトップ用) で、もう 1 つはモバイル デバイス用に設計されています。どちらも同じコンテンツですが、モバイル サイトは電話用に設計されています (iPhone、ブラックベリーなど)。
これが私が探しているものです:
ユーザーがモバイル デバイスで私のサイトにアクセスすると、自動的にモバイル バージョンにリダイレクトされます。モバイル版には、「完全な html を表示」というリンクがあります。そのリンクをクリックすると、使用しているデバイス (デスクトップ、iPhone など) に関係なく、サイトの完全版に送信されます。
Litespeed Web サーバーを使用します。
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 ベースの Web サイトであり、SEO コンポーネント (sh404sef) がインストールされていますが、それが問題を引き起こしているかどうかはわかりません。sh404sef は、URL を seo フレンドリーな URL に変換します。
いくつか助けることができますか?