Rediriger un internaute vers un site mobile

Résolu/Fermé
gwen007 Messages postés 78 Date d'inscription mardi 24 février 2015 Statut Membre Dernière intervention 23 juin 2023 - 22 juil. 2016 à 13:11
gwen007 Messages postés 78 Date d'inscription mardi 24 février 2015 Statut Membre Dernière intervention 23 juin 2023 - 22 juil. 2016 à 13:53
Bonjour, j'ai un site pour le bureau et je souhaiterai rediriger les personnes vers le site mobile quand c'est detecté, mais je comprend pas pourquoi ce code conseillé par "Comment ca marche" fonctionne pas pour moi ? Je l'ai ajouté à mon fichier hatccess..

RewriteCond %{HTTP_USER_AGENT} "ipod|iphone|ipad|android|palm|googlebot-mobile" [NC]          
RewriteRule (.*) https://www.commentcamarche.net/ [R=301,L]


Merci pour votre aide..
A voir également:

1 réponse

gwen007 Messages postés 78 Date d'inscription mardi 24 février 2015 Statut Membre Dernière intervention 23 juin 2023 4
22 juil. 2016 à 13:53
j'utilise ceci et ca fonctionne bien ;)
if ( (navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/Android/i) ) ) {
window.location = "http://www.lagoo.com";
}
0