Browser sniffing on the server side is a bad idea because it is unreliable and not a proof that a given browser is unable to use your app.
First, certain browsers (like Opera) can/will send in another user agent because it makes the browser more 'compatible' (in other words, it works around the very technique you plan to use).
Second, it's not because it's Internet Explorer that it will necessarily not work. Your attempt will also rule out Internet Explorer 9, which has very good chances of being compatible with your web app.
Instead, you should, on the client-side, check that features you expect are indeed there. You rely on document.getElementsByClassName
? Try this:
if (document.getElementByClassName == undefined)
document.location.replace('Unsupported browser URL here');
You rely on <canvas>
? Try this:
if (document.getElementById('canvas-element').getContext == undefined)
document.location.replace('Unsupported browser URL here');
You rely on complex CSS3 rules? Have such a rule hide a message intended to legacy browsers.
.error-message:not(.unexistant-class) {
/* this rule will be dropped by browsers that don't support the not()
selector */
display:none;
}
In short, check for features instead of for a user agent. If the client has all the features you want, there's no reason to leave it behind.