Are you facing the error, IIS redirect not working?
This guide is for you.
The <httpRedirect> element configures settings for Internet Information Services (IIS) 7 that redirect client requests to a new location.
Basically, URL redirection can be frustrating for website owners if the redirection is not working properly. The URL rewrite requires the understanding of the rules before writing it.
In this context, we shall look into the common error when setting redirection from IIS and methods to fix it.
How redirection is set from IIS ?
Here, you will learn how to set redirection from IIS. The redirection for a domain is set from URL rewrite in IIS.
i. Start >>Administrative Tools >> Internet Information Services (IIS) Manager >> Sites >> Domain_name >> URL rewrite.
ii. Select a new rule and choose a blank rule in Inbound Rules. Enter the rule based on the requirement and apply the rule once completed.
Why IIS redirect not working happens ?
Here, we will look at the common errors during setting up redirection in IIS and how to resolve them.
1) HTTP to HTTPS not working
One of the most common error faced is HTTP to HTTPS not working. Recently a customer contacted us mentioning that the redirection is not working.
On analyzing, we saw that the HTTPS entry was not in the binding. HTTPS requests use secure port 443. By default, only port 80 is accessible.
In order to fix it it is important to add the HTTPS entry to binding.
2) Redirection type not set properly
Another common error is because the 301 redirection type is not set for the redirection. On creating an URL redirect rule for domain 301 redirection type has to be set. A 301 redirect is a permanent redirect from one URL to another.
In this case, you need to verify the details and change the redirection type.
3) Incorrect rules
Creating rules in IIS can be confusing. A small mistake in the rule can make the redirection not work. So, creating the URL rewrite rules needs to be right.
To resolve this, simply analyze the rules and correct the rules to make the site redirect properly.