Bobcares

IIS URL Rewrite module – Facts to know

by | Dec 12, 2019

Have you ever got stuck with IIS URL rewrite module? Here are the steps for you.

The URL Rewrite Module rewrites the URLs to simple, user-friendly, and search-engine friendly addresses that are displayed to users or in Web applications.

At Bobcares, we often receive requests with the IIS URL rewrite module as part of our Server Management Services.

Today, let’s have a deep discussion on this topic and see how our Support Engineers deal with this IIS URL rewrite module.

 

How URL Rewrite Module Can Be Used?

URL Rewrite permits to replace the URLs generated by a Web application. By the URL Rewrite module the URLs become more user-friendly and search engine friendly. Now let’s see how our Support Engineers redirect the sites to https with the URL Rewrite module.

1. We opened the IIS Manager and select the Website.

2. Checked that the Rewrite module is installed on it. If not, we installed the module by one of the following methods.

  • Install the URL Rewrite via Web Platform Installer.
  • Download the URL Rewrite module from the official website of Microsoft.

3. We selected the URL Rewrite option from the IIS section of the website.

4. After that, we clicked Add Rules option on the Actions pane. The Action pane located on the right-hand side.

5. Then we select Blank Rule and click on the Ok button.

IIS URL Rewrite module

6. We specify the redirection name and follow the below steps in the Requested URL section,

  • Select Matches the Pattern in the Requested URL drop-down menu.
  • Select Regular Expressions in the Using drop-down menu
  • We entered the following pattern in the Pattern section: (.*)

7. In the Conditions section, We select Match all under the Logical Grouping drop-down menu and press Add.

8. In the prompted window, we entered {HTTPS} as the condition input and ^OFF$ as the pattern. Also, we selected the Matches the Pattern for the input string.

9. After that in the Action section, we select the Redirect as the action type and specify the following rule for Redirect URL.

https://{HTTP_HOST}/{R:1}

10. Also, we set the Redirect type as Permanent (301) and click the Apply button.

 

How to fix the problem in the Redirection?

Let us discuss the common error our customer faces when setting up redirection. Also, how we resolve it for our customers.

 

URL Rewrite module error

In some cases, the site doesn’t redirect to https. The redirection rules are written in the web.config file located in the document root directory of the website. We checked the redirection rule in the web.config file. The code was not present on the web.config file. Thus we update the URL rewrite module and add the redirection again.

Else we can add the below contents in web.config to resolve the error.

<configuration>
 <system.webServer>
 <rewrite>
 <rules>
 <rule name="force http" enabled="true" stopProcessing="true">
 <match url="(.*)" />
 <conditions>
 <add input="{HTTPS}" pattern="^OFF$" />
 </conditions>
 <action type="Redirect" url="https://{HTTP_HOST}{R:1}" redirectType="Permanent" />
 </rule>
 </rules>
 </rewrite>
 </system.webServer>
</configuration>

Also, Using the URL Rewrite module we performed the Rewrite Action also. A Rewrite action which replaces the current URL string with a substitution string.

 

Incorrect rules

Another common reason for the error is because of incorrect rules. Creating rules in IIS can be confusing. A small mistake in the rule can make the redirection not to work. So, creating the URL rewrite rules needs to be right. So our engineers analyze the rules and correct the rules to make the site to redirect properly.

 

[Need more assistance in the URL Rewrite module? We will help you.]

 

Conclusion

In short, the URL Rewrite module makes the redirection in Windows to an easy task. Today, we saw how our Support Engineers assisted our customers in URL redirection.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.