MentorMakers Login Sign up

Do More with MentorMakers

Free tools. Powerful features. Built for a smarter tomorrow.

  • 129 Free Tools
  • Most tools — no signup
  • Temporary files handled for processing
  • AI Assistant built in
  • Made in Pakistan 🇵🇰
Explore All Tools
SEO & Website Optimization Sep 25, 2026 · 2 min read

How to Force HTTPS on Your Website

Force all traffic to HTTPS so every visit is encrypted and the padlock stays on — the .htaccess rule to add and what to check before adding it.

M By the Mentor Makers team
How to Force HTTPS on Your Website

Forcing HTTPS means any visitor who types your domain with http:// (or no protocol) is automatically redirected to the secure https:// version. It ensures the padlock appears in all browsers, prevents mixed-content warnings, and satisfies Chrome's increasingly prominent "not secure" label for HTTP pages.

Before Adding the Redirect

Confirm these two things first — skipping them can make your site inaccessible:

  1. An SSL certificate is installed and working. Open https://yourdomain.com directly in a browser. If the padlock appears and the page loads, you're ready. If you see a certificate error, fix that first.
  2. Your .htaccess file backs up. Download a copy before editing it. A syntax error in .htaccess can bring down the site.

The Redirect Rule

Add this to your .htaccess file, ideally at the top before other rules:

``apache RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] ``

This redirects any HTTP request to the same URL on HTTPS. Use the .htaccess Generator to generate this and other common rules cleanly. For the conceptual background on 301 redirects, see what is a 301 redirect and when to use it.

Testing After Adding the Rule

  1. Open http://yourdomain.com (plain HTTP).
  2. Confirm it redirects to https://yourdomain.com.
  3. Check that the page loads correctly with a padlock.
  4. Visit a few other pages to confirm the redirect applies everywhere.

Mixed Content: The Next Step

After forcing HTTPS, some pages may show a "mixed content" warning — the page itself is HTTPS, but some resources (images, scripts, embedded content) still have http:// URLs. Fix by:

  • Changing http:// to https:// in the HTML or CMS where these resources are referenced.
  • Or changing them to // (protocol-relative), which inherits the page's protocol.

Check your browser's developer console (usually F12 → Console) for "mixed content" errors pointing to the specific resources that need fixing.

If the Site Goes Down After Adding the Rule

Restore the original .htaccess from your backup immediately. Syntax errors in htaccess cause a 500 error. Use the .htaccess Generator to generate clean rules rather than typing them manually, which reduces the chance of syntax errors.

The SEO Signal

Google has used HTTPS as a positive ranking signal since 2014, though it's modest. The more significant ongoing benefit is that Chrome displays a "Not Secure" warning for HTTP pages, which reduces trust and can increase bounce rates. Visitors who see "Not Secure" in the address bar, especially on a form or payment page, frequently leave without completing the action. Forcing HTTPS eliminates this warning permanently. After setup, confirm in Google Search Console that the HTTPS version is set as the preferred domain, and that any canonical tags across the site point to HTTPS URLs rather than HTTP. For the related topic of redirecting old URLs after domain changes, see what is a 301 redirect and when to use it.

#force https #ssl redirect #htaccess https

Frequently Asked Questions

Do I need an SSL certificate before forcing HTTPS?

Yes — you need a valid SSL certificate installed on your domain first. If you force HTTPS without one, your site becomes inaccessible. Let's Encrypt provides free certificates.

Will forcing HTTPS hurt my SEO?

No — it helps. Google treats HTTPS as a positive signal and has since 2014. HTTP pages may get a "not secure" warning in Chrome, which discourages visitors.

What if I have mixed content warnings after enabling HTTPS?

Mixed content means some resources (images, scripts, stylesheets) are still loading over HTTP. Update their URLs to HTTPS or use protocol-relative URLs.

Is an HTTP to HTTPS redirect a 301 or 302?

Always a 301 (permanent). You're permanently moving the site to HTTPS, not temporarily testing it.

Try it yourself

Do it in seconds Free

Every tool on MentorMakers is free — or just tell the AI Assistant what you need.

Browse all tools

0 Comments

Log in to comment

← Back to blog

Advertisement
Processing your file…
This can take a few seconds for larger files.
Bookmark this page
Press Ctrl+D for quick access next time