logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Apache View previous topic :: View next topic
Reply to topic   Topic: Exclude user agent from rewrite
Author
Qmpeltaty



Joined: 06 Feb 2008
Posts: 182
Location: Poland

PostPosted: Mon 27 Jan '14 15:13    Post subject: Exclude user agent from rewrite Reply with quote

I have a rewrite for mobile clients :

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipad|nokia" [NC]
RewriteRule ^$ https://www.myudomain.com/Mobile [L,R=302]

My mobile site is HTML5 written and old phones doesn't support it. How to exclude f.x. old nokias - like 6220 and rewrite old phones to /Mobile_old?
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7306
Location: Germany, Next to Hamburg

PostPosted: Mon 27 Jan '14 21:02    Post subject: Reply with quote

Since your first rewrite rule has a condition for the "good guys" you could add a second rules with a condition for the old user agents. Or use a PHP script[1] to detect and redirect with that.



[1] https://github.com/JBlond/Mobile-Detect
Back to top


Reply to topic   Topic: Exclude user agent from rewrite View previous topic :: View next topic
Post new topic   Forum Index -> Apache