Force WWW on Azure with web.config

Having issues forcing WWW on web.config. I am using the code below but having issues when not using WWW. at the start and wanting /about/ to be the target, but the script forces the WWW but forgets about the /about/. Example of script and results below.

I’m guessing a simple / or $ or something else will fix the entire world for me.

<rule name="Add WWW prefix" stopProcessing="true"> <match url="(.*)" ignoreCase="true" /> <conditions> <add input="{HTTP_HOST}" pattern="^mydomain.co.uk$" /> </conditions> <action type="Redirect" url="https://www.mydomain.co.uk/{R:0}" redirectType="Permanent" /> </rule> 

Desired URL: https://www.mydomain.co.uk/about/ http://www.mydomain.co.uk/about/Forwards Correctly to the desired URL https://mydomain.co.uk/about/Forwards to https://www.mydomain.co.uk http://mydomain.co.uk/about/Forwards to https://www.mydomain.co.uk

submitted by /u/ChrisHallUK
[link] [comments]

Leave a Reply