Switching your website to HTTPS should be a top priority. With HTTPS, you get improved security, trust signals for visitors, and a boost in search engine rankings. The good news is migrating to HTTPS is free and easy to implement in most cases.
In this comprehensive guide, I‘ll explain multiple methods to redirect from HTTP to HTTPS in WordPress and other platforms. By the end, you‘ll have the steps to get your site on HTTPS today.
Why You Should Migrate to HTTPS
Before we get into the technical how-to, let‘s quickly cover the benefits of HTTPS. Here are two big reasons you should switch:
1. Security
HTTP web traffic is sent in plain text and vulnerable to eavesdropping and man-in-the-middle attacks. HTTPS connections encrypt all data between the browser and server using SSL/TLS protocols. This protects sensitive user information like passwords and credit cards.
HTTPS is a must for any website handling user logins, ecommerce transactions, or personal data.
2. SEO Ranking Boost
Google and other search engines now use HTTPS as a positive ranking signal. Sites served over HTTPS get a slight boost compared to equivalent HTTP sites.
Google wants to incentivize everyone to adopt HTTPS for better web security. Migrating demonstrates you take security seriously.

Ways to Redirect HTTP to HTTPS
There are several methods to implement an HTTP to HTTPS redirect depending on your site‘s technology stack:
- Web server configuration (Nginx, Apache)
- Cloud proxy services (Cloudflare)
- Platform specific tools (cPanel, Kinsta)
- Application frameworks (Django, Rails)
The most common options are the web server and Cloudflare. I‘ll cover these plus a few alternatives below.
Choosing the right approach depends on where you are hosting and what technology you use. The good news is most website platforms make shifting to HTTPS simple.
Step-by-Step: Redirect to HTTPS on Common Stacks
Let‘s look at how to configure the HTTP to HTTPS redirect on some of the most popular site setups.
I‘ll provide code samples you can copy and tweak for your scenario. Be sure to take backups before making changes in case you need to roll back.
Apache
If your site runs on Apache, enable HTTPS in your httpd.conf file:
-
SSH into your server and edit the Apache config file:
cd /etc/httpd/conf sudo cp httpd.conf httpd.conf.backup sudo vim httpd.conf -
Verify the
mod_rewritemodule is active by ensuring this line is present:LoadModule rewrite_module modules/mod_rewrite.so -
Add the following directives anywhere in
httpd.conf:RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] -
Save changes and restart Apache to apply the new config.
This will redirect all HTTP traffic permanently (301) to HTTPS.
Nginx
For sites running on Nginx, edit your server block to enable the redirect:
-
Login to your server and open the Nginx config file in edit mode:
sudo vim /etc/nginx/sites-enabled/default -
Add this line inside the main
server { }block:return 301 https://$host$request_uri; -
Save changes and restart Nginx.
Now all requests to the HTTP site will get a 301 Moved Permanently to the HTTPS URL.
Cloudflare
If your domain is using Cloudflare, you can set up HTTPS redirection in two ways:
1. Page Rules
- Login to the Cloudflare dashboard and select your site.
- Go to Page Rules and create a new page rule.
- Set the URL pattern to
*example.com/*to match all pages. - Add a setting to Always Use HTTPS and deploy.
This will redirect all traffic through Cloudflare to HTTPS.
2. Edge Certificates
- Go to the SSL/TLS tab and scroll to Edge Certificates.
- Change the setting to "Full" or "Full (strict)".
- Click "Enable" under HTTP Strict Transport Security to get the HSTS header.
The edge certificate allows flexible redirect options. Enable HSTS too for extra security.
cPanel
To redirect in cPanel, edit the .htaccess file:
-
Login to cPanel and open the file manager.
-
Locate the
.htaccessfile in your site‘s root folder. -
Add the following lines:
RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] -
Save changes.
This will now redirect all traffic to HTTPS for any site hosted on that account.
Sucuri
If your site is behind the Sucuri Web Application Firewall (WAF), you can easily activate HTTPS:
- Within the Sucuri dashboard, go to the Websites tab.
- Click Settings next to your site.
- Go to HTTPS/SSL and set the SSL mode to "Full HTTPS".
- Enable "HTTPS only site" under Protocol Redirection.
- Click Save Changes.
Sucuri will provision a free SSL certificate and configure the redirect automatically.
Kinsta
For sites hosted with Kinsta, you can force HTTPS in one click:
- Log in to MyKinsta and select your site.
- Go to the Tools tab.
- Turn on the setting for Force HTTPS.
It‘s that simple! Kinsta will take care of enabling HTTPS and redirecting requests.
SiteGround
If your site is on SiteGround, here are the steps to activate HTTPS:
- Log in to SiteGround and go to Websites.
- Click Site Tools next to your site.
- Go to Security > HTTPS Enforce.
- Toggle on the button to force all requests over HTTPS.
SiteGround makes the switch easy. Just click and enable!
Other Ways to Redirect HTTP to HTTPS
Here are a few more options for redirecting to HTTPS depending on your technology:
- Django: Set
SECURE_SSL_REDIRECT = Truein the settings file. - Ruby on Rails: Use the SSL requirement middleware.
- WordPress: Try a plugin like Really Simple SSL.
- Frameworks: Most have a way to force HTTPS, check their docs!
If your stack isn‘t covered above, search for "[platform] force ssl" to find the relevant way to redirect.
Implementing the Redirect Correctly
Once you‘ve set up the HTTPS redirect, there are a couple best practices to follow:
Test the Redirect Works
Verify the redirect functions properly by:
- Clearing cookies and cache and visiting the HTTP URL directly. It should 301 redirect.
- Running a redirect checker tool to validate the HTTPS works.
- Testing across desktop and mobile to be sure nothing is broken.
Fix Mixed Content
Mixed content warnings happen when the HTTPS page requests HTTP resources like images or scripts. This triggers browser warnings.
- Use a mixed content scanner to detect violations.
- For WordPress, use a plugin like SSL Insecure Content Fixer to fix mixed content automatically.
- In Joomla, try the Easy HTTPS extension.
- Update any hardcoded URLs in the source to use HTTPS or protocol-relative links.
Harden Your HTTPS Config
To further enhance security:
- Enable HTTP Strict Transport Security (HSTS) to force browsers to use HTTPS. Add the
Strict-Transport-Securityheader. - Set a Content Security Policy (CSP) to restrict resource origins. This protects against code injection attacks.
- Get an A+ SSL rating using SSL Labs or Mozilla Observatory to check your config.
- Validate DNSSEC/DANE is enabled for certificate validation.
Choosing the Right Redirect Approach
When planning your HTTPS migration, think about which redirect method makes the most sense:
- Use the server/application redirect if possible for more control. This handles redirects at the edge.
- For sites behind a CDN, use page rules or proxy headers to redirect.
- Choose the option with the least impact on site performance.
- Some options like Cloudflare flexibly do page-specific or full site redirects.
Many sites use a mix – like Nginx rules combined with Cloudflare page redirects for optimal flexibility.
Potential Challenges with HTTPS Redirects
While migrating to HTTPS is generally straightforward, watch out for:
- Site breakage: Test extensively and roll back changes safely in case something stops working.
- SEO impact: Use 301 permanent redirects and update sitemaps.
- Speed differences: Measure page load impact and optimize images, caching, etc if needed.
- Old content: Review internal links, sitemaps, and old posts for HTTP references.
- HTTPS mixed content: Fix insecure requests for JS, CSS, images, etc flagged by browsers.
Plan for some incremental cleanup and testing work after cutting over the main redirect.
Wrapping Up
I hope this guide gives you a good overview of how to redirect HTTP to HTTPS in WordPress and other platforms. The faster you implement HTTPS, the sooner you get improved security and a boost in search rankings.
While the specific technical steps depend on your site‘s infrastructure, the process is largely straightforward in most cases. Many hosting providers have one-click HTTPS tools now.
Take advantage of free SSL certificates and auto-provisioning to painlessly switch over. HTTP is rapidly becoming legacy. Join the future with HTTPS.
I welcome your feedback and questions in the comments! Please share if you found this tutorial helpful.