Search
Close this search box.

Configuring URL Redirection in IIS for Shopping

1e-shopping-app-store

Users of 1E Shopping may want to configure URL redirection in IIS, in order to simplify the URL users need to remember. Since 1E likes to anticipate every eventuality for our customers, our own Biswa Das has written the following redirect guide.

Redirection refers to the process of configuring a web server to redirect users from one location to a new site. There are several reasons why a user might want to redirect clients to a new location (such as from an http to a secure https connection, or if someone has moved a server URL to another server which require a redirect). To implement this URL redirection requires specific features to be installed at hosting servers like IIS, etc.
In IIS, there are two different ways by which we can implement this, 1. HTTP Redirect and 2. URL Rewrite.

1. HTTP Redirect in IIS:

 

HTTP Redirect in IIS

If a user wants to redirect an application’s URL to a specific location (e.g. all the listed URLs of http//server1/etc.. redirect to exact https://server2), or if all the listed URL formats of server2 are THE same as server1, then it became easier to implement this HTTP Redirection.For setup and configuration, please follow the steps mentioned in below link, https://www.iis.net/configreference/system.webserver/httpredirect

2. URL Rewrite in IIS:

 

URL Rewrite in IIS

However, if a user wants to redirect an existing URL to a new URL, and if the application URL formats are different (as below), then it becomes easier to implement this URL Rewrite.
 

Localtest Url

 
To set this up simply follow the steps below…
Step 1: Open the IIS (Run > inetmgr) at “shoppingcm12.mycompany.com” hosting server and select the website “shoppingcm12. mycompany.com” from left menu. Please check if it contains the “URL Rewrite” icon or not as below.
 

Url Rewrite

 
If you don’t find this icon, please look to download the actual version file from the URL (https://www.iis.net/downloads/microsoft/url-rewrite) and install that at the server.
Step 2: Once the installation complete, please create a new Web.config file or use the exiting config file from the root hosting folder (as shown below) of shoppingcm12.mycompany.com website and copy the below code inside the <system.webServer> section of that Web.Config file,

<rewrite>
<rules>
<rule name="ApproveLinkRedirect" stopProcessing="true">
<!--match url="Shopping/ApproveLink.aspx" /-->
<match url="^.*(?:Shopping/ApproveLink.aspx).*$" />
<conditions>
<add input="{QUERY_STRING}" pattern="Approve=(\d+)" />
</conditions>
<action type="Redirect" url="https://shopping.mycompany.com/Shopping/approver/approve?processingId={C:1}" redirectType="Permanent" appendQueryString="false" />
</rule>
<rule name="RedirectAllRequests" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="false" pattern="" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://shopping. mycompany.com" appendQueryString="false" />
</rule>
</rules>

 

Explore IIS Url Rewrite

 
Finally, restart the IIS at the server and check the URL redirection.

Report

The FORRESTER WAVE™: End-User Experience Management, Q3 2022

The FORRESTER WAVE™: End-User Experience Management, Q3 2022