私のサイトの.htaccessファイルに問題があります。htaccess - モバイルウェブサイト(サブドメイン上)にリダイレクトしようとするときの問題
私が得るエラーは、何度もリダイレクトしようとしていることです。
現時点では、デスクトップ上にあるときはいつでも、URLをサブフォルダ/dist
にリダイレクトする必要があります。モバイルの場合は、代わりにモバイル版のモバイルサイトにアクセスする必要がありますmobile.
私のhtaccessファイルで始まるサブドメインは、次のようになります。
RewriteEngine on
RewriteBase/
# Check if this is the noredirect query string
RewriteCond %{QUERY_STRING} (^|&)m=0(&|$)
# Set a cookie, and skip the next rule
RewriteRule^- [CO=mredir:0:www.mywebsite.com/dist]
RewriteCond %{HTTP_HOST} ^mywebsite\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.mywebsite\.com$
RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
RewriteRule ^/?$ "http\:\/\/www\.mywebsite\.com\/dist" [R=301,L]
# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\.
# Can not read and write cookie in the same request, must duplicate condition
RewriteCond %{QUERY_STRING} !(^|&)m=0(&|$)
# Check to make sure we haven't set the cookie before
RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC]
# Now redirect to the mobile site
RewriteRule^http://mobile.mywebsite.com [R,L]
は誰が助けることができますか?
がこの
おかげ
は役立つだろう。 – DmitriD
リソースの読み込みに失敗しました:net :: ERR_TOO_MANY_REDIRECTS – Nick
あなたのモバイルサイトは 'm.'または' mobile.'で始まりますか? – anubhava