I'm currently working on an extremely html5 / css3 based portfolio, inevitably it looks like hell in IE, instead of spending hours, maybe days, to fix all the problems I've decided to create a "simple" version of the site for Internet Explorer users.

How would I go about redirecting users of any IE version to the simple version using .htaccess?

I.e. http://example.com gets redirected to http://example.com/ie/

Thanks all.

  • It would be a better idea to make it a graceful degradation than providing a different version for IE, as Olly said, Opera can pretend to be MSIE. Divya Manian about 10 years ago

4 answers

This was chosen as the best answer

In your .htaccess files:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^index\.html$ http://example.com/ie/ [L]
RewriteRule  ^/$ http://example.com/index.html [L]

That will push a request into that subdirectory, though they could still manually move to the normal site.

Untested, but probably works! If not, check the MSIE bit...

Answered about 10 years ago by Rich Bradshaw
  • Note that you have to be very careful with things like this. Opera pretended to be MSIE for a long time and still includes the option to do so. Olly Hodgson about 10 years ago

Why wouldn't you use the Javascript tools that allow IE to see a graceful degradation of your site (or maybe a close replica)

There's http://ejohn.org/blog/html5-shiv/ and http://www.modernizr.com/

Answered about 9 years ago by Tony Crockford
  • I agree, it's too easy to change User Agent so it's not a good idea to rely on it. Feature detection is maybe longer to implement, but it shows your clients that you have high skills to use new technologies and still support older ones. Gabriel about 9 years ago

u could use the

<!--[if IE]>
According to the conditional comment this is Internet Explorer<br />

or more appropriately

<!--[if IE 6]>
Special instructions for IE 6 here

for instance:

in your header you could use the if ie to load another css...

<link href="css/main.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<link href="css/main_ie6.css" rel="stylesheet" type="text/css" />

and then replace the rules that don't suit you.

Answered about 10 years ago by prozaker
joneff 28

IE does not accept application/xhtml and alike, so you could check for those headers as well ;) So if the browser supports XHTML mime, you could server you HTML 5 in XML flavour (self closing tags) if not, serve the page normally either HTML 4.01 or XHTML 1 as text/html.

Answered almost 11 years ago by joneff