0

I'm working on an IIS redirection rule where I've the following website:

https://www.test.com/smart/frid/index.html
to be redirected to the following:
https://mysmart.test.com/frid/index.html

Providing that, the parameter in the old url should be send to the new one too For example:

https://www.test.com/smart/frid/index.html?id=260&z=3L&hsnr=3-bis

Here is the current settings: enter image description here

1

1 Answer 1

1

Before you begin, understand the following process before hand and let me know if its confusing.

Application Request Routing (ARR) is an IIS extension which handles URL redirecting and rewriting features at IIS level. URL Rewrite is another extension that sets up rules using which ARR does redirection. With these steps, you can create a pattern rule on the source website. ARR will match incoming requests' URL with the URL pattern you have configured on that website. If the pattern matches, ARR can redirect the requests to destination website along with the parameters. The destination website's URL is also configured in that rule.

IIS supports these extensions which you can download. Download and install them, then they will be available when you re-open the IIS Manager program.

Once these extensions are installed, re-open IIS Manager, select the root node of websites in left side i.e. the name of your machine, then in middle section of IIS Manager, you should be able to see Application Request Routing Cache feature. Double click to open it, click on Server Proxy settings on the right, on next screen, enable the checkbox for "Enable Proxy". After that you need to add a redirection rule on the source website from which you want to transfer to destination website. For that, select the source website in IIS Manager, then in middle section of IIS where all features are listed, look for URL Rewrite, open it.

  1. On the top Right hand side Click on Add Rule(s)… and then select Inbound Blank rule -> ok. Note: You should create Inbound rule not outbound.
  2. Fill the details that resembles something as follows Name : AnyNameYouPrefer
  3. Requested URL : Matches the Pattern
  4. Using : Regular Expressions
  5. Pattern : ^smart/(.*)
  6. Ignore Case : checked
  7. Action type: Redirect
  8. Rewrite URL : https://mysmart.test.com/{R:1}
  9. Append Query string : checked

Here I have written that all incoming requests' URL must have smart/ in it along with some parameters after slash "/". These requests will be transferred to destination which is specified in "Rewrite URL".

{R:1} means the URL portion that remains after that matching pattern which need to be carried from source URL to destination URL.

7
  • But, I've more than one directory under smart. Should I change the regular expression to ^smart/frid/(.*)
    – Krank
    Dec 11, 2018 at 11:58
  • @Krank yes. In your case, there can be multiple rules that would vary for different directories. One rule per pattern and destination. If it's new destination then new pattern so new rule. Dec 11, 2018 at 12:00
  • @Krank Please try it out and let me know if you encounter any problem. Dec 11, 2018 at 12:00
  • I get the following error: The requested URL was rejected. Please consult with your administrator.
    – Krank
    Dec 11, 2018 at 12:05
  • @Krank Did you follow all steps carefully? Dec 11, 2018 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.