r.vengadesh
r.vengadesh

Reputation: 1837

IIS redirect rule not working

<rule name="Directories The" stopProcessing="true">
    <match url="^Directories/The" />
    <action type="Redirect" url="/" />
</rule>`

I have two url like this www.mydomain/Directories/the and www.mydomain/Directories/the-hindu. But i only want to redirect first url only. If i put above code two urls are redirecting.

I tried with exact match and wild card also not working. I dont want www.mydomain/Directories/the-hindu to my home page

`

Upvotes: 0

Views: 352

Answers (1)

Victor Leontyev
Victor Leontyev

Reputation: 8736

The problem is that your regexp ^Directories/The is matching for both URLs:

  • www.mydomain/Directories/the
  • www.mydomain/Directories/the-hindu

You need to add the end of string condition to your regexp. The correct rule should be:

<rule name="Directories The" stopProcessing="true">
    <match url="^Directories/The$" />
    <action type="Redirect" url="/" />
</rule>`

And this rule will match only www.mydomain/Directories/the

Upvotes: 1

Related Questions