« Previous Next »

Thread: CSS broken on IE, not FF or Safari, with URLRewrite

Last post 11-20-2008 4:35 PM by MPCEO. 6 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (7 items)

Sort Posts:

  • 11-20-2008, 10:50 AM

    • MPCEO
    • Not Ranked
    • Joined on 11-20-2008, 3:42 PM
    • Los Angeles
    • Posts 4

    CSS broken on IE, not FF or Safari, with URLRewrite

     hi

    I'm using the Microsoft UI Extension (URLRewrite Module) which results in this web.config file

     

    <?xml version="1.0" encoding="UTF-8"?>
    <configuration>
        <system.webServer>
            <rewrite>
                <rules>
                    <rule name="RedirectUserFriendlyURL1" stopProcessing="false">
                        <match url="^schedule_details\.asp$" />
                        <conditions>
                            <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)$" />
                        </conditions>
                        <action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" redirectType="Permanent" />
                    </rule>
                    <rule name="RewriteUserFriendlyURL1" stopProcessing="false">
                        <match url="^([^/]+)/([^/]+)/?$" />
                        <action type="Rewrite" url="schedule_details.asp?{R:1}={R:2}" />
                    </rule>
                </rules>

            </rewrite>
        </system.webServer>
    </configuration>

     

    it seems to work fine in Safari and Firefox, but the CSS is broken in IE.  I've made sure to have the css file with the leading /, as below:

    <LINK href="/css/styles.css" rel="stylesheet" TYPE="text/css">

    any ideas what I might be doing wrong?

    thanks


  • 11-20-2008, 1:16 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 661

    Re: CSS broken on IE, not FF or Safari, with URLRewrite

    If you generated these rules by using User Friendly URL rule template then it looks like you still have Go Live version of the module. RTW version has a fix for this template so that the rewrite rule it generates has two extra conditions that prevent this rule from rewriting requests for existing files. The RewriteUserFriendlyURL1 rule should look like this:

    <rule name="RewriteUserFriendlyURL1" stopProcessing="false">
       <match url="^([^/]+)/([^/]+)/?$" />
       <conditions>
          <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
          <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
       </conditions>
       <action type="Rewrite" url="schedule_details.asp?{R:1}={R:2}" />
     </rule>

    http://ruslany.net
  • 11-20-2008, 1:47 PM In reply to

    • MPCEO
    • Not Ranked
    • Joined on 11-20-2008, 3:42 PM
    • Los Angeles
    • Posts 4

    Re: CSS broken on IE, not FF or Safari, with URLRewrite

    thanks Ruslany...but how would the rule look if it were to change the resulting url to have form I intended...meaning the url was something like:

     http://www.example.com/schedule_details.asp?event_id=12

    to

      http://www.example.com/event_id/12

     

    thanks again

  • 11-20-2008, 1:59 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 661

    Re: CSS broken on IE, not FF or Safari, with URLRewrite

    You you mean the "RedirectUserFriendlyURL1" rule then it would not change.

    http://ruslany.net
  • 11-20-2008, 2:18 PM In reply to

    • MPCEO
    • Not Ranked
    • Joined on 11-20-2008, 3:42 PM
    • Los Angeles
    • Posts 4

    Re: CSS broken on IE, not FF or Safari, with URLRewrite

     great...thanks..then one final question (which I deeply appreciate your help here), were I to extend this example to one where there are two query strings, as in

    http://www.example.com?event_id=12&title=make+my+day

    how would that change the rules?

     

    thanks again

  • 11-20-2008, 3:25 PM In reply to

    • ruslany
    • Top 25 Contributor
    • Joined on 07-01-2007, 3:38 PM
    • Redmond, WA
    • Posts 661

    Re: CSS broken on IE, not FF or Safari, with URLRewrite

    You could use the "User Frienldy URL" rule template to generate rules for this. Here is what it would produce:

          <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
                        <match url="^schedule_details\.asp$" />
                        <conditions>
                            <add input="{REQUEST_METHOD}" negate="true" pattern="^POST$" />
                            <add input="{QUERY_STRING}" pattern="^([^=&amp;]+)=([^=&amp;]+)&amp;([^=&amp;]+)=([^=&amp;]+)$" />
                        </conditions>
                        <action type="Redirect" url="{C:1}/{C:2}/{C:3}/{C:4}" appendQueryString="false" redirectType="Permanent" />
                    </rule>
                    <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                        <match url="^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$" />
                        <conditions>
                            <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                            <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        </conditions>
                        <action type="Rewrite" url="schedule_details.asp?{R:1}={R:2}&amp;{R:3}={R:4}" />
                    </rule>

    http://ruslany.net
  • 11-20-2008, 4:35 PM In reply to

    • MPCEO
    • Not Ranked
    • Joined on 11-20-2008, 3:42 PM
    • Los Angeles
    • Posts 4

    Re: CSS broken on IE, not FF or Safari, with URLRewrite

    Thank you!

Page 1 of 1 (7 items)
Microsoft Communities