Kitz ADSL Broadband Information
adsl spacer  
Support this site
Home Broadband ISPs Tech Routers Wiki Forum
   Compare ISP   Rate your ISP
   Glossary   Glossary
Please login or register.

Login with username, password and session length
Advanced search  


Author Topic: IIS - URL rewrite  (Read 471 times)


  • Reg Member
  • ***
  • Posts: 999
IIS - URL rewrite
« on: November 27, 2021, 06:06:12 PM »

any IIS gurus here?

i'm trying to set up a URL rewrite to allow a temporary "under maintenance" page to be displayed.
the rewrite works, however it's also filtering out the CSS and JS files that the page links to.

i know i need to set a rule to exlude them, but can't seem to get it to work.
anyone know the correct way to do this?

the following is what's currently set up

Code: [Select]
<?xml version="1.0" encoding="UTF-8"?>
<rule name="HTTP to HTTPS redirect" enabled="true" stopProcessing="true">
  <match url="(.*)" />
  <add input="{HTTPS}" pattern="off" ignoreCase="true" />
  <action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
<rule name="Site Maintenance" enabled="true" stopProcessing="true">
<match url="(.*)" />
<add input="{REQUEST_URI}" pattern="maintenance" negate="true" />
<add input="{REQUEST_URI}" pattern="images" negate="true" />
<action type="Redirect" url="/maintenance.asp" appendQueryString="false" redirectType="Temporary" />
            <mimeMap fileExtension=".apk" mimeType="application/" />
            <clientCache cacheControlMode="DisableCache" />
        <caching enabled="false" enableKernelCache="false">
                <add extension=".js" policy="DisableCache" kernelCachePolicy="DisableCache" />
        <httpErrors errorMode="Detailed">
            <remove statusCode="404" subStatusCode="-1" />
            <error statusCode="404" prefixLanguageFilePath="" path="/404.html" responseMode="ExecuteURL" />

and the CSS and JS files are located in

Code: [Select]
<link rel="stylesheet" href="/includes/css/style.css"/>
<script src="/includes/scripts/startscript.js"></script>

the page that is being used as the redirect is /maintenance.html


  • Reg Member
  • ***
  • Posts: 999
Re: IIS - URL rewrite
« Reply #1 on: November 27, 2021, 06:44:48 PM »

i think i worked it out, for anyone that might need to know in the future
i added the following lines to the rule

Code: [Select]
<add input="{URL}" negate="true" pattern="\.css$" />
<add input="{URL}" negate="true" pattern="\.js$" />