Redirecting HTTP to HTTPS on WordPress

WordPress HTTP to HTTPS

Would you like to always redirect HTTP to HTTPS on your WordPress website or blog? Then you must read this guide as it’ll help you to configure this.

From the Search Engine Optimisation (SEO) standpoint delivering you website over the secure HTTPS protocol is utmost important. For example, your domain is my-web-app.com and you’d want to always serve your website over HTTPS regardless of someone arriving to it from http:// or https://, right?

Therefore, you might find yourself requiring to set the HTTP to HTTPS redirection on your WordPress website or blog at some stage during your project’s live cycle.

If you host your site on Windows IIS the chances are you will find web.config file in the root folder of your site’s file system (picture below).

WordPress webconfig

Simply follow this process and you should have the HTTP to HTTPS redirection in place in seconds.

  1. Navigate to your site’s file system using your preferred FTP client, such as FileZilla.
  2. Find web.config file and open it in text editor, such as Visual Studio Code or Notepad++.
  3. Locate rules tag inside of the file.
  4. Paste the following code just below the rules tag.
<clear />
<rule name="Redirect to https" stopProcessing="true">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTPS}" pattern="off" ignoreCase="true" />
    </conditions>
    <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
  1. Save web.config file and test the HTTP to HTTPS redirection in web browser.

On a side note, if you are still in the mood of code or configuration changes, why not look at my other post explaining How to change MySQL Database Settings in WordPress.

Marcin Narloch

Marcin Narloch

Creative and out-of-the-box thinker with strong interests and knowledge in technology and innovation.
WordPress MySQL Config Next post Changing MySQL Database Settings in WordPress

Leave a Reply

Your email address will not be published.