This is a follow-up to my recent post showing how quick the creation of a self-signed certificate can be. Now that you have an SSL certificate it is helpful to ensure that all calls to your site go through on SSL. The easiest way to do this ( and save yourself typing time) is to create a Url rewrite rule via IIS’s Url Rewrite Module, https://www.iis.net/downloads/microsoft/url-rewrite.
Ensure Url Rewrite Module is Installed
For redirect rules to be written you need to confirm the module is installed. The best way to do this is to open up IIS, select a web application, and check for the module’s icon.
If you do not see the icon, then you will need to install the module before moving on. You can install the module through the Web Platform Installer or the link at https://www.iis.net/downloads/microsoft/url-rewrite.
Run the Create Redirect Rule Script
- Download and save as CreateRedirectRule.ps1 from Gist, https://gist.github.com/gillissm/0344c9551e7a8180354544ff5f60e821.
- Open a PowerShell command prompt, ensure you are running it as Admin
- Change directory to the location you saved to in step 1
- At the prompt enter, and complete the requested parameters
OR you can submit the parameters at run
.\CreateRedirectRule.ps1 -SiteBinding "coffeehouse.thecodeattic.com" -RuleName "Redirect to SSL"