0

I am using Apache 2.2.3 (old version, I know)

So I am trying to redirect based on older versions of IE (6 and 7 for now... ) and I am getting a redirect loop.

I have:

RewriteEngine On RewriteCond %{HTTP_USER_AGENT} "MSIE\ [6-7]" [NC] RewriteRule .* https://example.com/upgrade.html [R=302,L]

Using something like IE7 in a VM just takes forever and doesn't load at all. Also tried this with browserstack, with the same result. Normally my site would come up just fine, but this rewrite is not working out too well for me. I want to redirect to one page if Apache sees IE6,7 instead of going to the homepage.

Using the javascript libraries for this would not work for me because everything else is dynamically generated.

Vnge
  • 195
  • 3
  • 12

1 Answers1

1

If example.com/upgrade.html is on the same server, you need to add a check to make sure not to do the redirect if the user is already on the upgrade.html URL (such as after having been redirected to it).

Try this instead (the second line is what I added):

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/upgrade.html$
RewriteCond %{HTTP_USER_AGENT} "MSIE\ [6-7]" [NC]
RewriteRule .* https://example.com/upgrade.html [R=302,L]
sa289
  • 1,318
  • 2
  • 18
  • 44
  • Thanks that worked!! Would you have any suggestions to be able to serve images on that page as well? Something like: `RewriteCond %{REQUEST_URI} !^/images/` after the first check? – Vnge Aug 26 '15 at 19:23
  • I had to add my images to that and css. Thanks for the initial push forward! – Vnge Aug 26 '15 at 19:39