IIS 7 and Above
URL Rewrite Module
How to set up url rewrite to redirect when a word causes a conflict i...
Last post Jun 14, 2018 02:50 PM by dwarthen
Jun 12, 2018 03:31 PM|dwarthen|LINK
I'm trying to set up several redirects using the IIS Manager url rewrite tool which I am new to. I am using "inbound rule". In certain instances, I am getting an error because the term/word which I am using as my pattern match, also appears in the redirect
We would like something like
to redirect to
So I use "orientation" as the pattern to match it also matches that term in the redirect url which then causes a conflict. I get this as an error. "The page isn’t redirecting properly."
I'm sure I'm missing a simple solution. How can I avoid this problem?
Thank you in advance.
Jun 12, 2018 04:43 PM|Rovastar|LINK
There are many ways of doing these things.
Quickest (if you are using regular expressions)
is to use ^ which donates that your "word" must appear at the start of the match. (e.g. the first "word" it sees)
Jun 12, 2018 06:18 PM|dwarthen|LINK
Thank you so much. This is exactly what I needed.
Jun 13, 2018 02:55 PM|dwarthen|LINK
I have one more question if you don't mind.
There are a couple cases where the same page starts with the same word and I don't want both to redirect.
For example, mysite.com/page I would want to redirect to mysite.com/newpage.
However, I do not want mysite.com/page-again to redirect.
If I'm using ^page for my redirect, how can I limit that to only mysite.com/page and not mysite.com/page-again?
Jun 14, 2018 07:55 AM|deepakpanchal10|LINK
You had mentioned that,"For example, mysite.com/page I would want to redirect to mysite.com/newpage.
However, I do not want mysite.com/page-again to redirect."
In that case you can try to match pattern properly.
You can try to add '$' to end your pattern.
So it will only work with '/page' and not get matched with '/page-again'.
You can try to make a test using 'Test Pattern' feature like below.
Jun 14, 2018 02:50 PM|dwarthen|LINK