CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   .htaccess redirect for specific browser/OS combination (http://www.codingforums.com/showthread.php?t=266537)

Suresure 06-28-2012 01:05 PM

.htaccess redirect for specific browser/OS combination
 
I don't know if this is possible! I need to redirect if the user is accessing the site using Chrome on OS X, but not Chrome on Windows - and the same for Safari.

Can I target, specifically, Chrome OS X and ignore Chrome Windows? I think these are the agents for the two:

Code:

' Chrome, MAC OS
' Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_7) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30

' Chrome, Windows 2008
' Mozilla/5.0 (Windows NT 6.0) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.91 Safari/534.30

Sorry - this is pretty ignorant of me... thanks for reading!

Suresure 06-29-2012 08:30 PM

I have a solution from Stack Overflow and thought I'd post it here too:

Code:

RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Mac\ OS\ X.*Chrome [NC,OR]
RewriteCond %{HTTP_USER_AGENT} Mac\ OS\ X.*Safari [NC]
RewriteRule .* http://www.redirecthere.com/ [L]



All times are GMT +1. The time now is 08:23 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.