I want detect user browsers with .htaccess & redirect when user does not entered the site from cell phone
Asked
Active
Viewed 4,032 times
3
-
@SalmanPK, it is not duplicate – totali Jun 04 '11 at 11:26
-
2see this http://stackoverflow.com/questions/1005153/auto-detect-mobile-browser-via-user-agent – Samuel Katz Jun 04 '11 at 11:27
-
@SalmanPK, but I want do it with .htaccess – totali Jun 04 '11 at 11:31
1 Answers
8
You can start here with an example.
# Rewrite requests from all user-agents except modern Internet Explorer, Firefox, Opera
RewriteCond %{HTTP_USER_AGENT} !^Mozilla/4\.[0-9]+\ \(compatible;\ MSIE\ [0-9.]+
RewriteCond %{HTTP_USER_AGENT} !^Mozilla/5\.0 \(([^;]+;\ )*[^;]+\)\ Gecko/2[0-9]{3}\ Firefox/[0-9.]+
RewriteCond %{HTTP_USER_AGENT} !^Opera/[0-9.]+
RewriteRule .* X.html [L]
Adjust as necessary.

ta.speot.is
- 26,914
- 8
- 68
- 96