locked
web.config Help RRS feed

  • Question

  • User-129390817 posted

    Hello,

    Please correct me if I am in the wrong place.  And please forgive my lack of aspx knowledge.

    I am wanting to force trailing slashes, but when I do, it removes all the formatting of the website.  It basically looks like all the HTML and CSS is removed, looking like a text website with images all aligned to the left.

    Below is what I put with in the <rules></rules> markup.  There are other rules in this section as well, ie. www redirect.  Below is everything within the rules/rewirte markup.  I changed the domain name, just for show here.  Any thoughts?  Thank you ahead of time.

    <rewrite>
    <rewriteMaps configSource="rewritemaps.config">
    </rewriteMaps>
    <rules>
    <rule name="Permanent Redirect Rule" stopProcessing="true">
    <match url=".*" />
    <conditions>
    <add input="{Static301Redirects:{REQUEST_URI}}" pattern="(.+)" />
    </conditions>
    <action type="Redirect" url="http://www.domain.com{C:1}" appendQueryString="false" redirectType="Permanent" />
    </rule>
    <rule name="Add trailing slash" stopProcessing="true">
    <match url="(.*[^/])$" />
    <conditions>
    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Redirect" redirectType="Permanent" url="{R:1}/" />
    </rule>
    <rule name="special passthrough" stopProcessing="true">
    <match url="^(login|episerver|util)/" ignoreCase="true" />
    <action type="None" />
    </rule>
    </rules>
    </rewrite>

    Wednesday, January 22, 2020 3:14 PM

All replies

  • User1535942433 posted

    Hi bmcintyre1,

    Accroding to your description, could you tell us wheather your aspx page are with master?

    Where your css or js file in your program?

    I suggest you could press F12 to check the css url.

    Best regards,

    Yijing Sun

    Thursday, January 23, 2020 6:41 AM
  • User-129390817 posted

    Thank you for your reply.

    Below are the only cases of CSS I see at least on the home page, thoughts?

    <link href="https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic" rel="stylesheet" type="text/css" /><link href="https://fonts.googleapis.com/css?family=Open+Sans:400italic,400,600,700" rel="stylesheet" type="text/css" /><link href="https://fonts.googleapis.com/css?family=Droid+Sans:400,700" rel="stylesheet" type="text/css" />
    
    
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
    
    <link rel="stylesheet" href="/content/magnific-popup.css" />
    <script src="//assets.adobedtm.com/c876840ac68fc41c08a580a3fb1869c51ca83380/satelliteLib-0f02bbcce77b6ac942d9e829d137afe00ffbb43f.js"></script>
    <script src="/bundles/modernizr?v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1"></script>
    <link href="/Content/css?v=0ngJwiIzp6IGOzIP7GeA304VIlJku_DH41Znc-uCJUU1" rel="stylesheet" />

    Thanks

    <script src="//assets.adobedtm.com/c876840ac68fc41c08a580a3fb1869c51ca83380/satelliteLib-0f02bbcce77b6ac942d9e829d137afe00ffbb43f.js"></script> <script src="/bundles/modernizr?v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1"></script>

    Thursday, January 23, 2020 12:48 PM
  • User409696431 posted

    Try typing the address of one of your site's CSS files (yoursite.com/content/magnific-popup.css for example) in the browser and see what happens. Are you redirecting .css, .js, and image files to a trailing slash, too?

    And how about yoursite.com/bundles/modernizr?v=inCVuEFe6J4Q07A0AcRsbJic_UE5MwpRMNGcOtk94TE1 Does that add a trailing slash?

    Monday, January 27, 2020 6:26 AM
  • User-129390817 posted

    Hello!

    Thank you for your reply.

    Yes I think it does add a trailing slash, so that makes sense.

    Is there any way to NOT change the path of the css or .js?

    Thanks again!

    Monday, January 27, 2020 1:49 PM
  • User409696431 posted

    You have to exclude them from the rule.   E.g., add another condition (or conditions, as needed) such as:

    <add input="{URL}" pattern="/bundles/" negate="true" />
    Monday, January 27, 2020 3:53 PM