Hi Lee,
Take a look at the code below:
Code:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Opera.*
RewriteRule ^.*$ redirectToWebsite [L]
This will redirect all requests from an opera browser to redirectToWebsite. If you want more specific browser to be redirected you can do something like this:
Code:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Mozilla.*
RewriteCond %{HTTP_USER_AGENT} ^Opera.*
RewriteRule ^.*$ redirectToWebsite [L]
This will redirect all the Mozilla and opera browsers to redirectToWebsite.
The part ^Mozilla.* is a regular expression so it can match a lot of different browsers are once.
The part ^.*$ after the RewriteRule is also a regular expression. If you want to redirect the opera browser when they hit the all the files that starting with tour in their filenames you can do this:
Code:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^Opera.*
RewriteRule ^tour.*$ redirectToWebsite [L]
I hope this will help you!
Best Wishes,
Arian
Bookmarks