I'm trying to redirect IE-user to a specific page by using htaccess. This is what I got so far:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.*Trident.*$
RewriteRule (.*) /not-supported-browser.html [R=301,L]
</IfModule>
But whenever I'm requesting some page with IE11, I'll get the error "too many redirects". I changed my condition to Firefox and Chrome, same behaviour so I think the condition is fine.
I'm using a CMS but this error also occurs when I'm deleting all CMS-specific rewrites in my htaccess.
Any ideas what I am missing?
You will get too many redirects because even after you redirect to not-supported-browser.html
client browser remains same and first condition will still hold true.
You can use this rule to prevent this behavior:
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Trident [NC]
RewriteRule !^not-supported-browser\.html$ /not-supported-browser.html [R=301,L,NC]
Negative pattern !^not-supported-browser\.html$
will skip redirecting if page is already /not-supported-browser.html
.
Make sure to clear your browser cache when you test this change.