Traditional .htaccess or <!--[if lt IE 7]><meta http-equiv="refresh" content="0; url=/assets/errors/ie.html"/><![endif]--> methods don't work to redirect users in Craft.

I know it may seem taboo, but quite frankly I don't want anyone who is using IE7 or below to access my site. I'd like to completely redirect them to a separate page/template that will instruct them on why they can't see the site and how to upgrade.

Any ideas how best to achieve this?

Cheers, Mark.


I agree with Bryan, personally I like to use the Browser-Update.org notification.

Nevertheless, if you want to use .htaccess just make sure you put your redirect code before Crafts routing:

<IfModule mod_rewrite.c>
    RewriteEngine On

    # Redirect old Browsers
    RewriteCond %{HTTP_USER_AGENT} "MSIE [1-7]" [NC]
    RewriteRule ^(.*)$ http://something.com/else [R=301,L]

    # Crafts routing
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
    RewriteRule (.+) index.php?p=$1 [QSA,L]
  • 1
    Would like to second the Browser-Update.org javascript bar. I'd certainly rewrite their page-on-click or other on-click result, which you can, as it's a little tilty so I'd like to make own best recommendations. The bar is nice, though. Jul 25 '14 at 7:44

I can't understand why you would simply turn users away. It's part of why we use graceful degradation. It's ugly but usable in browsers that are old like IE7. In Craft's case, there's nothing stopping those methods from working because they are outside Craft's control. This is probably an IE7 bug.

My suggestion is to keep the users and just show them ugly content, or even add a div that explains why it's ugly. If it's really that important to redirect, use JavaScript. It works mostly fine in IE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.