mardi 19 août 2014

Several domains and only one redirection needed on htaccess file


Vote count:

0




I have several domains, but i will take the case of only two different domains domain1.com and domain2.com. Only the first one has a mobile version whose URL os m.domain1.com, I don't have a mobile version for the second one.


Both domains are in the same filepath (on drupal), so when a user tries to go any of those domains (domain1.com and domain2.com) from a mobile device, the user is redirected to m.domain1.com


So, what I want is that when a mobile device connects to domain2.com it serves domain2.com (no redirection needed), and only when it connects to domain1.com, the redirection to m.domain1.com should happen


This is what I got in my .htaccess file



RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|iphone|ipod|opera mobile|palmos|webos" [NC]
RewriteCond %{HTTP_HOST} ^domain1.com$
RewriteCond %{HTTP_HOST} !^m\.
RewriteRule ^$ http://m.domain1.com/ [L,R=302]


Can anybody help me please?



asked 1 min ago







Several domains and only one redirection needed on htaccess file

Aucun commentaire:

Enregistrer un commentaire