.htaccess Tip: How to Redirect EVERY Version of Your Site to HTTPS


Learn How to Code ⚠️ PHP, CSS, JavaScript, WP Coding

In this day and age, you are going to struggle to find websites that are not using the HTTPS protocol. Many of us have had to redirect our http pages to https in the past. You can get it done easily through .htaccess but you need to make sure your directives cover every version. In our case, while every regular page was redirecting properly, our search pages with no “WWW” were not. While the site was still viewable, some of the icons were not loading properly.

Here is how we fixed it:

As you can tell, this version is not dynamic, so you will have to change mysite to your own site. A more dynamic version of it looks like this:

[HT]

More WordPress reading: