Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have W2008 running IIS and have about 20 websites (all PHP, about half are WP) running on it.

Currently I have this in the header on a few sites and it is working. But it is getting hard to manage because even though I am the admin there are a lot of developers and they could overwrite the header if they wanted on most sites.

<!--[if IE 8]>
<script type="text/javascript">
        window.location = "http://example.com/wedontsupportIE8.html";
    </script>
<![endif]-->

Is there a way to set up a rule on the server that would have the same functionality?

Current rule I have tried:

I have added rules on web server and they basically don't work right. I had the redirect to /home/index.php already working for the past 6 months. When I add the new rule first it does the following:

  • in IE8 - 404 error for any directory on site and it reverts to the root
  • in IE10, FF, Chrome, Safari - it just redirects to /home as it should.

webconfig below

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
        <rules>
  <rule name="IE8rewriteall" patternSyntax="Wildcard">
                    <match url="*" />
                    <conditions>
                        <add input="{HTTP_USER_AGENT}" pattern="*MSIE*" />
                    </conditions>
                    <action type="Rewrite" url="http://example.com/ie/index.html" />
                </rule>
            <rule name="Root Hit Redirect" stopProcessing="true">
                <match url="^$" />
                <action type="Redirect" url="/home/index.php" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
</configuration>
share|improve this question
add comment

1 Answer 1

Here you go.... this should work:

<rule name="IE8FacePalm" stopProcessing="true">
    <match url="\" ignoreCase="true" />
    <conditions logicalGrouping="MatchAny" trackAllCaptures="false">
        <add input="{HTTP_USER_AGENT}" pattern="MSIE 8.0" />
    </conditions>
    <action type="Redirect" url="http://x.com/a-url" appendQueryString="false" />
</rule>
share|improve this answer
    
Hi bybe - Tried this out and it isn't catching IE8. Also tried "MSIE 8.0" with asterisks. Also when I add my home redirect rule I get nothing but 500s. Thanks for your help. –  blankip Apr 13 at 16:30
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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