test LWS
How can you redirect your website to the mobile version? | LWS

How can you redirect your website to the mobile version?

Procédure

Why redirect your website to the mobile version?

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?

How do you redirect your website to the 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]

How do you redirect your mobile site to the computer version?

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]

Conclusion

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.

Rate this article :

4.8/5 | 5 opinion

This article was useful to you ?

Article utileYes

Article non utileNo

MerciMerci ! N'hésitez pas à poser des questions sur nos documentations si vous souhaitez plus d'informations et nous aider à les améliorer.


Vous avez noté 0 étoile(s)

Similar articles

0mn reading

Explicit TLS FTP connection

1mn reading

How to clear my google chrome browser cache

1mn reading

How do I edit a host on Windows or Mac?

1mn reading

Site error during installation


Questions sur l'article
edwinm Il y a 1258 days
Bonjour, Merci pour ces précieuses aides, j'ai une question par rapport à cette méthode, google préfère me référencer la version mobile que la version ordinateur. Est-ce que vous avez une astuce pour que mon site normal soit référencé par google? Merci
See the
2 answers
fabrice-LWS - Il y a 1257 days
The Google search engine uses robots to index, reference and update its results on websites present on the web. Unfortunately, we cannot intervene in the indexing and referencing results as well as the treatment that is carried out by Google for your website.If your website is not indexed in Google, I invite you to use the tool provided by google for this purpose.Google Search Console formerly called Google Webmaster Tools The address to access this tool is: https://www.google.com/webmasters/tools/ If this access address has changed, you can type 'Google Search Console' directly into google to find their updated address. If you think that your website is poorly referenced in Google: Please note that referencing is a complex matter, and we strongly recommend that you subscribe to a professional referencing offer (directly accessible from the referencing section of our home page) to ensure that your site appears in more search engines. What's more, this will enable you to discuss with the professional concerned the reason why the mobile site seems to be better referenced than the PC site.
Utile ?
dmtl46 Il y a 769 days
Bonjour, la redirection ne se fait que sur la home. Si on atterrit sur une page secondaire de la version mobile depuis son pc, et inversement, la redirection ne se fait pas. Avez-vous une astuce pour que celle-ci s'applique à toutes les pages du site ?
See the
1 answers
Benjamin-LWS - Il y a 768 days

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

Utile ?

Ask the LWS team and its community a question