Men om dem besöker standard hemsidan via SSL så hedrar den till mobil sidan med HTTPS också.
Har inte hunnit fått mina SSL secikat för min mobila sida.
Går det och skriva om den så det blir som den heder jag har på 2 raden längst ner i koden?
<IfModule mod_rewrite.c>
RewriteBase /
RewriteEngine On
\# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^\|&)mobile=1(&\|$)
RewriteRule ^ - \[CO=mobile:1:%{HTTP_HOST}\]
\# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^\|&)mobile=0(&\|$)
RewriteRule ^ - \[CO=mobile:0:%{HTTP_HOST}\]
\# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^\|&)mobile=0(&\|$)
RewriteRule ^ -
\# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ \[OR\]
RewriteCond %{HTTP_USER_AGENT} "android\|blackberry\|ipad\|iphone\|ipod\|iemobile\|opera mobile\|palmos\|webos\|googlebot-mobile" \[NC,OR\]
RewriteCond %{HTTP:Profile} !^$
\# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\\.
\# 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.domain.com%{REQUEST_URI} \[R,L\]
Hursomhelst, regeln redirectar ju till http://m.domain.com%{REQUEST_URI} så mobila användare borde hamna på icke-SSL-varianten. Är det möjligen så att m.domain.com pekar mot en helt annan webbrot med en annan .htaccess som rikat om besökaren till https?
<IfModule mod_rewrite.c>
RewriteBase /
RewriteEngine On
\# Check if mobile=1 is set and set cookie 'mobile' equal to 1
RewriteCond %{QUERY_STRING} (^\|&)mobile=1(&\|$)
RewriteRule ^ - \[CO=mobile:1:%{HTTP_HOST}\]
\# Check if mobile=0 is set and set cookie 'mobile' equal to 0
RewriteCond %{QUERY_STRING} (^\|&)mobile=0(&\|$)
RewriteRule ^ - \[CO=mobile:0:%{HTTP_HOST}\]
\# cookie can't be set and read in the same request so check
RewriteCond %{QUERY_STRING} (^\|&)mobile=0(&\|$)
RewriteRule ^ -
\# Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ \[OR\]
RewriteCond %{HTTP_USER_AGENT} "android\|blackberry\|ipad\|iphone\|ipod\|iemobile\|opera mobile\|palmos\|webos\|googlebot-mobile" \[NC,OR\]
RewriteCond %{HTTP:Profile} !^$
\# Check if we're not already on the mobile site
RewriteCond %{HTTP_HOST} !^m\\.
\# 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.domain.com%{REQUEST_URI} \[R,L\]
För det andra så funkar inte browser- eller systemsniffing särskilt bra över huvud taget, och i synnerhet inte när det gäller handhelds (som t.ex. mobiltelefoner).
Det du kan göra är att erbjuda länkar från ena varianten till den andra och eventuellt länka till https://www.handsetdetection.com/ som kan hjälpa en del.
Så det spelar som ingen roll om jag skriver i en class eller om jag skriver i htaccess går den via https adress så går dem till https adress på subdomänen.
Blir snart så förbannad att jag köper mig en SSL för mobila sidan också för få det löst.