0

I do not want to redirect any malicious link or user to redirect to other domain. Instead it should redirect to the domain which I mentioned. So for that, I have written below Rewrite URL rule by using IIS server

<rewrite>
  <rules>
    <clear />
    <rule name="Redirect to https" stopProcessing="true">
      <match url=".*" />
      <conditions>
                    <add input="{HTTPS}" pattern="off" />
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="^([a-zA-Z0-9-_]+.)https://nvmbd1bkh150v02.rjil.ril.com$" ignoreCase="true" negate="true" />
      </conditions>
      <action type="Redirect" url="https://nvmbd1bkh150v02.rjil.ril.com/FiberInventoryPortal" redirectType="Permanent" appendQueryString="false" />
    </rule>

  </rules>
</rewrite>

But what happening here is, all my application CSS gets disturbed. Please suggest what should I do in this case.

Nad
  • 4,605
  • 11
  • 71
  • 160

2 Answers2

1

Not sure what you mean with "malicious" links but my guess is that you want visitors to use just that specific host name. And also that every URL should always start with /FiberInventoryPortal/.

So possibly this is what you want:

<rewrite>
    <rules>
        <clear />
        <rule name="Force HTTPS" stopProcessing="true">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAll">
                <add input="{HTTPS}" negate="true" pattern="^ON$" />
                <add input="{HTTP_HOST}" negate="true" pattern="^nvmbd1bkh150v02\.rjil\.ril\.com$" />
            </conditions>
            <action type="Redirect" url="https://nvmbd1bkh150v02.rjil.ril.com{REQUEST_URI}" redirectType="Permanent" appendQueryString="false" />
        </rule>
        <rule name="Redirect to FiberInventoryPortal" stopProcessing="true">
            <match url=".*" />
            <conditions>
                <add input="{REQUEST_URI}" matchType="Pattern" pattern="^/FiberInventoryPortal/" ignoreCase="true" negate="true" />
            </conditions>
            <action type="Redirect" url="https://nvmbd1bkh150v02.rjil.ril.com/FiberInventoryPortal/{R:0}" redirectType="Permanent" appendQueryString="false" />
        </rule>
    </rules>
</rewrite>
Marco Miltenburg
  • 6,123
  • 1
  • 29
  • 29
-1

According to your url rewrite codes, I found you will redirect all the request to the https://nvmbd1bkh150v02.rjil.ril.com/FiberInventoryPortal include the CSS file. This is the reason why your CSS file not working.

If your css file is also in the new site's FiberInventoryPortal folder. I suggest you could try below url rewrite rule.

<rewrite>
  <rules>
    <clear />
    <rule name="Redirect to https" stopProcessing="true">
      <match url=".*" />
      <conditions>
                    <add input="{HTTPS}" pattern="off" />
                    <add input="{HTTP_HOST}" matchType="Pattern" pattern="^([a-zA-Z0-9-_]+.)https://nvmbd1bkh150v02.rjil.ril.com$" ignoreCase="true" negate="true" />
      </conditions>
      <action type="Redirect" url="https://nvmbd1bkh150v02.rjil.ril.com/FiberInventoryPortal/{R:0}" redirectType="Permanent" appendQueryString="false" />
    </rule>

  </rules>
</rewrite>
Brando Zhang
  • 22,586
  • 6
  • 37
  • 65
  • so will it redirect to off all other links of other domain to `https://nvmbd1bkh150v02.rjil.ril.com/FiberInventoryPortal` right ? – Nad Dec 19 '19 at 05:30
  • Yes, it will auto add the url path at the end of the `FiberInventoryPortal `. I guess you want to get the css file on the `nvmbd1bkh150v02.rjil.ril.com` site. – Brando Zhang Dec 19 '19 at 05:40
  • not only the css file, when any unknown user inserts some other domain link by some burp tool then it should redirect to the domain which I mentioned – Nad Dec 19 '19 at 05:41
  • what happened mate ? is your above code proper for what I asked for? should I retest with the testing team? – Nad Dec 19 '19 at 06:08
  • You could tell us which the CSS url you want to generate by using url rewrite. For example the old css url is xxxx, the new css url is xxx. Then we could generate the rewrite rule according to your description. – Brando Zhang Dec 19 '19 at 06:31
  • i dont want to generate css url.. i want that any malicious link should redirect to the default link which I provided – Nad Dec 19 '19 at 06:32