Htaccess redirection for version Movable Web

Control of Htaccess Redirection for version Movable Web

Sometimes some clients can order a movable version to us for their site, and that works of parallel form to the version. The most adapted would be to create a same style sheet with an adaptive design responsive and, but sometimes by diverse reasons it can be that the client does not want to redesign the Web, and prefers to decide on this type of €œsolution€: Htaccess redirection for version Movable Web.
responsive

Steps to follow:

  • To create subdomain

    First it would have to be to create a space where to be able to send the requests Web that come from mobiles and tablets, perhaps most logical it would be to create a subdomain or a directory in the root of the domain father.

  • To redirect requests Web with .htaccess

    The second step that we would have to do is to redirect the requests Web that come from movable devices to the subdomain. A way to do it of many that there are would be through file .htaccess.

    RewriteEngine On RewriteBase/RewriteCond % \ {HTTP_USER_AGENT} android|avantgo|blackberry|to blazer|compal|elaine|fennec|hiptop|iemobile|IP (hone|or d)|rainbow|kindle|lge |maemo|midp|mmp|ob operates m (|in) i|palm (you)? |phone|p (ixi|re)/|to plucker|pocket|psp|they symbian|treo|up. (to browser|link)|vodafone|wap|Windows (EC|phone)|xda|xiino [NC] RewriteRule ^$ http://subdomain.domain.com/ [R, L]
  • Publication of the movable version

    Once we have separated the requests Web that come from devices smartphone and tablet€¦ we can dedicate to us to create a specific design that can as well be adaptive between the different models and sizes from screen.

Another version in htaccess that redirects based on the navigating Web is the one that I have observed in the application: http://detectmobilebrowsers.com
In this different tool we can see way to redirect based on the navigating Web of the movable device, and it is possible to be done in many languages, type python, Perl, JSP, Javascript, php€¦ etc.

Perhaps although most efficient is to create a design responsive from the version, also other alternatives for the different supplies exist and demands that can arise to us in our projects, being an acceptable solution the one to redirect the different devices, although absolutely does not finish being trustworthy and some can be escaped by the route that does not have.

I hope that this article serves to you as help,
A greeting,
Oscar/Devservice.es
By “scar Carrillo