Another post in our series on Creating Azure (hosted) WordPress Websites without knowing php or MySql!

To force the new WordPress website to resolve only to HTTPS, it is necessary to access the web.config file of the website, and add in an URL Rewrite Rule.

How do we quickly access the web.config file in an Azure hosted WordPress site?

Every Azure App Service (website) has an associated ‘scm’ service website or a Site Extension named Kudu created for your website . It is accessed by using the Source Control Management entry point https://<site-name>.scm.azurewebsites.net. NOTE: The custom domain name will not resolve with the scm modification to its URL – you must use the original *.azurewebsites.net DNS name to access Kudu. In our case, the https://tech-blog.scm.alvarnet.com will NOT work…we must use https://tech-blog.azurewebsites.net to access Kudu.

Kudu can also be accessed via the Azure Resource Manager (ARM) for your Azure website under Settings > Development Tools > Advanced Tools > Go > Read more about Kudu here.

To access the web.config file on the Kudu site > Debug console > CMD > site > wwwroot > scroll to find web.config > Edit (pencil icon on left):

Paste in the following code to set up the URL Rewrite to HTTPS Rule > Save
<!-- BEGIN rule TAG FOR HTTPS REDIRECT -->
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
<!-- END rule TAG FOR HTTPS REDIRECT -->

The website will now only resolve to https.

Our Azure hosted WordPress website is now setup with a custom domain name and forced HTTPS access – and is the basic ‘out-of-the-box’ default WordPress site, with the Twenty Seventeen Theme installed.

Read the other posts in our series on Creating Azure (hosted) WordPress Websites without knowing php or MySql!