jeudi 30 avril 2015

Htaccess mobile redirect two subdomains

can anyone please help

I have a website which redirects to

This works perfectly with the following htaccess code

# Check if this is the m=no query string

RewriteCond %{QUERY_STRING} (^|&)m=no(&|$)
 # Set a cookie, and skip the next rule
RewriteRule ^ - [CO=mredir:0:%{HTTP_HOST},S]
 # Check if this looks like a mobile device
RewriteCond %{HTTP:x-wap-profile} !^$ [OR]
 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\.
 # Can not read and write cookie in same request, must duplicate condition
 RewriteCond %{QUERY_STRING} !(^|&)m=no(&|$) 
 # Check to make sure we haven't set the cookie before
 RewriteCond %{HTTP_COOKIE} !^.*mredir=0.*$ [NC]
 # Now redirect to the mobile site
RewriteCond %{REQUEST_URI} !\.(?:gif|jpe?g|png)$ [NC] 
RewriteRule ^{REQUEST_URI} [R,L]

However my problem is I also have the subdomain which is now being redirected to the mobile subdomain m.. I do not want this subdomain ru to be redirected to the mobile version.

I want the desktop site to be redirected to

I want the desktop site to be redirected to

Please help thanks

Aucun commentaire:

Enregistrer un commentaire