Firstly, had to change the default port from 80 to 81. This is needed because https listens on port 80 (You may ignore this step ;).
- Also, I created a record in the host file to redirect traffic from the localhost/loopback address to 127.0.0.1 (This can be done in DNS too but I decided to use the host file)
This can be found in this path C:\Windows\System32\drivers\etc
So when you enter the IP or hostname, you are automatically redirected to the desired URL. Ensure you open the host file via elevated rights (This is better done by opening or running notepad as an Administrator and opening the path mentioned above. This makes saving any change possible and effortless.
- 127.0.0.1 mk.chris.com
- 1x.xx.xx.2 mk.chris.com
Note: To make this possible ensure the SSL setting is unchecked not to require certificate otherwise you will never be able to access it via HTTP.
- Click on the website and
- Navigate to the SSL Settings
- Double click to open and set as shown below
Now create a binding to allow HTTP connection for the website as shown below.
New to ensure the URL redirect works by redirecting to HTTPS, kindly follow these steps as shown below
- Under sites, select the desired website
- Click on URL rewrite (if you do not have this already installed, click on the web Platform Installer, run it and select URL rewrite to install).
- Click on Add Rule (Under Action)
- The Add Rule URL Opens up
- Enter any desired name to identify your rule
- Under the Match URl, enter matches the pattern
- Under “Using”, select Regular expression
- Under Pattern, select (.*)
- Select ignore cases, note: this is selected by default in most cases.
- Navigate to condition and click on “Add” to create a rule
- Set as shown below and click on Okay
- Under Actions “Action type”, select Redirect
Enter the Redirect URL and the
- Redirect type as “Found (302)”
Finally, click on apply on the top right side of the screen.