Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
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.
| |
|
Topic: Exclude user agent from rewrite |
|
Author |
|
Qmpeltaty
Joined: 06 Feb 2008 Posts: 182 Location: Poland
|
Posted: Mon 27 Jan '14 15:13 Post subject: Exclude user agent from rewrite |
|
|
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: 7371 Location: Germany, Next to Hamburg
|
Posted: Mon 27 Jan '14 21:02 Post subject: |
|
|
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 |
|
|
|
|
|
|