Procédure
Since the widespread introduction of smartphones and tablets, many companies are considering making their websites compatible, without having to completely recreate them. In fact, it may be more interesting to create a mobile version of the website. However, how do you redirect mobile and tablet users to your mobile version?
This tutorial will explain how to redirect your visitors from the http://www.exemple.com website to the mobile version called http://m.exemple.com/ .
To do this, you will need to create rewrite rules that will redirect visitors to your http://exemple.com website to the mobile version if they are using a smartphone or tablet. This involves an .htaccess file in which you will need to enter the following directives:
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos" [NC] RewriteRule ^$ http://m.example.com/ [L,R=302]
You can redirect users from the PC version to the mobile version. However, it may also be useful to be able to redirect visitors arriving on the Mobile version to the PC version in order to optimise your site for the type of medium used. To do this, you'll need to create a second .htaccess file in the folder for your Mobile site, to enable the redirection to take place. This file will include the following directives:
RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "!(android|blackberry|googlebot-mobile|iemobile|ipad|iphone|ipod|opera mobile|palmos|webos)" [NC] RewriteRule ^$ http://www.example.com/ [L,R=302]
You are now in a position to redirect your visitors to the website for PCs or the one optimised for smartphones and tablets. It's interesting to be able to redirect visitors according to the type of medium they're using.
Don't hesitate to share your comments and questions in the comments section.
Bonjour,
Nous vous remercions pour votre question et votre intérêt envers LWS. Malheureusement, nous ne comprenons pas ce que vous souhaitez dire, ce qui rend difficile pour nous de fournir une réponse satisfaisante.
Nous vous invitons donc à contacter notre système de support client pour obtenir de l'aide spécifique à votre situation. Nous avons une équipe de professionnels qualifiés prêts à vous aider et à répondre à toutes vos questions avec précision et rapidité. (Contacter le support LWS)
Merci de votre compréhension et nous espérons pouvoir vous aider bientôt.
Cordialement, L'équipe LWS
Ask the LWS team and the community. Answers are published after moderation.