New 24/7 monitoring and daily cloud backups now included in every Shield Pro plan.

HTTPS

Learn how to force HTTPS redirect on WordPress.

Visitors should always reach your site over HTTPS. WordPress URL settings, server redirects, and CDN SSL modes must agree or you get loops and cookie errors. This tutorial covers safe 301 redirects from HTTP to HTTPS.

Time: 20-40 minutes Level: Intermediate
Neil McNaught, founder of BugShield and WordPress author
Written by
Written by
Updated
Updated

What this problem looks like

Forcing HTTPS happens at three layers: the certificate on the host, WordPress URL settings, and a 301 redirect that upgrades http requests before PHP runs. Missing any layer causes mixed content or redirect loops.

Apache hosts usually rely on .htaccess. Nginx and managed WordPress need host panel redirect rules instead of pasted Apache snippets.

Step 1: Confirm SSL works on the host

Before forcing redirects, open https://yourdomain.com directly. If the certificate is invalid, fix that first. Let's Encrypt auto-renewal should be enabled in cPanel or your host SSL panel.

Step 2: Set WordPress to HTTPS

Settings → General → set both WordPress Address and Site Address to https://. If admin is unreachable, open wp-config.php in your site root, next to wp-admin and wp-content, and define WP_HOME and WP_SITEURL:

php
define( 'WP_HOME', 'https://example.com' );
define( 'WP_SITEURL', 'https://example.com' );

Step 3: Force HTTPS in .htaccess (Apache)

Find .htaccess in your site root, next to wp-admin and wp-content. Add this above the WordPress rewrite block. Back up .htaccess first via File Manager, SFTP, or FTP.

apache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

Step 4: Configure nginx or host redirects

On nginx, ask your host to add a return 301 https://$host$request_uri; rule. Managed WordPress hosts often provide a one-click Force HTTPS toggle that is safer than manual edits.

Step 5: Test wp-login, cookies, and checkout

Log out, clear cookies, and log in again over https. WooCommerce checkout must submit without browser warnings. If login loops, see our login redirect loop tutorial and verify siteurl matches how you access admin.

When to stop DIY and hire help

Redirect loops between Cloudflare, nginx, and WordPress are a common emergency call. BugShield aligns HTTPS end to end at a confirmed fixed price without trial-and-error on live shops.

Questions answered

WordPress HTTPS redirect FAQs

Answers about permanent redirects, WordPress URLs, server rules, Cloudflare, and avoiding too many redirects.

Should I redirect www to non-www or the reverse?

Pick one canonical hostname and 301 the other. Match what you set in Google Search Console and WP_HOME.

Can I force HTTPS with a plugin only?

Plugins run after WordPress loads. Server-level redirects are faster and catch http before PHP. Use both only if you understand the order.

Why does Force HTTPS cause too many redirects?

Cloudflare Flexible SSL plus WordPress https URLs is the usual cause. Switch Cloudflare to Full (strict).

Do I need HTTPS on staging?

Staging should mirror production SSL behaviour so you catch cookie and mixed content issues before go-live.

Should a WordPress HTTP to HTTPS redirect be permanent?

Yes. Use a 301 redirect after HTTPS works correctly across the site. Test login, forms, checkout, webhooks, and admin pages before treating the change as permanent.

Do WP_HOME and WP_SITEURL need to use HTTPS?

Yes. Both should use the final HTTPS hostname so WordPress generates secure internal links and login cookies that agree with the server redirect.

Can Cloudflare Flexible SSL cause a WordPress redirect loop?

Yes. WordPress may redirect the origin request to HTTPS while Flexible mode keeps contacting the origin over HTTP. Use Full (strict) with a valid origin certificate.

Where should I add a WordPress HTTPS redirect?

Use the server layer that owns the request, such as Apache .htaccess, nginx configuration, or the host redirect tool. Keep only one clear redirect path.

Will forcing HTTPS affect WordPress SEO?

A correct site-wide 301 redirect consolidates HTTP URLs into their HTTPS equivalents. Update the sitemap, canonical URLs, analytics, and Search Console property afterwards.

How do I verify a WordPress HTTPS redirect?

Test HTTP versions of the homepage, a post, wp-admin, and checkout. Each should reach the matching HTTPS URL through as few redirects as possible.

Would you rather a developer fixed it?

Request a fix at a confirmed price and speak directly with the BugShield developer working on your site.

Request a Fix