Redirect visitors using Internet Explorer

Hello My friends,

I know you are passing a nice holiday with your family and friends, so permit me to bother you with my question: How can I redirect visitors using Internet Explorer to a page web ? I hope it is possible to do it with htaccess, in the goal to redirect ALL visitors who visit any page on the website.

In fact, I have installed a wordpress website to a friend, and it works perfect on all the web browsers, but unfortunately not on Internet Explorer. The user should go to TOOLS option on IE, and change the navigation type from Quirks to Internet Explorer 9 to be able view the website properly.

Best regards to you all, and thanks in advance for your help!

Hi there,

There are many different things that can cause Quirks Mode, for example, having stuff before the doctype.
As a quick fix, try adding this to the head section of your document:

<meta http-equiv="X-UA-Compatible" content="IE=edge" />

If this doesn’t help, would it be possible for you to post a link to the site with a short description of the problem?

Um. the solution is to fix your web pages not to force IE users to fix your problem for you. If IE9 is going into quirks mode you have invalid code, invalid HTML, fix it.

Thank you guys for your help, I will try to fix it with Pullo’s solution, and get back to you. Regards!

Hi there, something like this should work:

if ( preg_match("/MSIE/",$_SERVER['HTTP_USER_AGENT']) )
  header("Location: indexIE.html");
  header("Location: indexNonIE.html");

There’s a good discussion of this here:

I put that edge line in my site a while back to text and it still kept going into quirks mode

Number 6

bbparis: Did including the meta element fix your web site in IE? If not, you may want to look at makingsure you’re using an HTML5 doctype: <!DOCTYPE html>. This will force later versions of IE into standards mode.

I want to reiterate that it is a very bad idea to force all versions of IE to redirect to a different page. While earlier versions of IE were behind the times due to a 5 year leave of absence, IE9, and especially IE10 are modern browsers. They should render your content as expected if you’re following standards. They shouldn’t require any extra effort to support on your part than other modern browsers. Redirecting all users of current and future versions of IE just harms the users that choose to use those browsers.

That would redirect anyone who has Firefox, Chrome, Safari or Opera set with a useragent containing MSIE to indexIE.html even though the browser is not Internet Explorer. All browsers can use a useragent that identifies them as Internet Explorer and many people have whatever browser they are using set that way to bypass all the stupid browser testing scripts in antiquated web pages that only allow you to visit the page using Internet Explorer.

Also it would not send anyone using Internet Explorer who has their useragent set to not contain MSIE to the indexNonIE.html page - Internet Explorer allows you to set the useragent to anything at all. It’s a good place to advertise where your ad is unlikely to be blocked.

The only way to properly identify Internet Explorer is by using conditional comments either in HTML or in JScript - it can’t be done on the server.

Yup, browser sniffing sucks, which brings us nicely back to @logic_earth ;'s point, that it would be better to fix the site in the first place.