How to redirect HTTP to HTTPS (and check it works)
Add a permanent 301 redirect so every http:// address sends visitors to the same page on https://. You can do it in your hosting, your CDN (such as Cloudflare) or your CMS, but only once you have a working SSL certificate.
When someone types your address starting with http://, your site should send them on to the https:// version automatically. If it doesn't, the old insecure address keeps loading as a separate copy of your site. Visitors may see a "Not secure" warning, and search engines may find two versions of every page.
What people see
The problem usually shows up in one of these ways:
- The browser shows "Not secure" next to your address when someone arrives on the
http://version. - Both
http://yoursite.comandhttps://yoursite.comload, and neither one changes into the other. - Old links, bookmarks, business cards and email signatures lead to the insecure version.
- The
wwwand non-wwwversions behave differently, so one is redirected and the other is not.
A missing padlock on a page that did redirect is a different problem called mixed content: the page is on HTTPS but still loads an image or script over HTTP.
Why it matters
Search. If both versions are reachable, Google can treat them as duplicates and split signals such as links between them. Google generally prefers HTTPS, but a clear redirect removes any doubt about which address you want shown.
Security. Anything sent over plain HTTP, including contact forms and logins, can be read or changed on the way. A redirect makes sure people end up on the protected version even if they arrive through an old link.
Trust and sales. A browser warning at the moment someone is about to fill in a form or pay is an easy reason to leave.
How to check if your site has it
All of these are free:
- Open a private browser window and type your address starting with
http://. Watch whether the address bar changes tohttps://by itself. - Repeat with and without
www, so you test all four combinations. - Try an inner page, such as
http://yoursite.com/contact, not just the home page. Some setups only redirect the home page. - If you are comfortable with a terminal, run the command below and look at the first lines of the answer.
curl -I http://yoursite.com/contact
A correct answer starts with HTTP/1.1 301 Moved Permanently (or HTTP/2 301) and includes Location: https://yoursite.com/contact. A 200 OK means the insecure page is simply being served.
Before you fix it: check the certificate
A redirect only helps if the HTTPS version works. Open https://yoursite.com and https://www.yoursite.com and make sure there is no certificate warning. Most hosts offer a free certificate (often from Let's Encrypt), usually in the control panel under SSL or Security. If the certificate is missing or expired, fix that first, otherwise visitors will hit a bigger error than before.
How to fix it in general
The goal is a permanent (301) redirect from every http:// URL to the same path on https://, in a single step, ending on your one preferred hostname (with or without www). Set it up in one place only: your server, your CDN or your CMS. Doing it in several places is a common cause of loops and redirect chains.
Common platforms
Menu names change between versions and themes, so treat these as pointers.
WordPress. First make sure Settings, General shows https:// in both WordPress Address and Site Address. Then add the redirect at server level (below) or use a well known plugin such as Really Simple SSL, which also helps with mixed content. Step by step: WordPress guide.
Apache (and many shared hosts). Add this near the top of the .htaccess file in your site's root folder, then test. Back up the file first.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
nginx. Add a server block that listens on port 80 and sends everything to HTTPS, then reload nginx.
server {
listen 80;
server_name yoursite.com www.yoursite.com;
return 301 https://$host$request_uri;
}
Cloudflare. Under SSL/TLS, Edge Certificates, look for Always Use HTTPS and turn it on. Make sure the encryption mode is Full or Full (strict), not Flexible, if your server already has a certificate. A mismatch is a classic cause of "too many redirects". More detail: Cloudflare guide.
cPanel. Newer versions have a Force HTTPS Redirect switch under Domains. Older ones need the .htaccess rule above.
IIS. Install the URL Rewrite module and add a rule that redirects HTTP requests to HTTPS with a permanent (301) redirect.
GoDaddy. It depends on your plan. Managed WordPress and cPanel hosting have their own settings or use .htaccess, while website builders often offer an HTTPS or SSL option in the site settings.
If you are not sure which one applies, ask your host or developer which layer handles the redirect on your site.
How to confirm the fix worked
- Repeat the four browser checks (
httpandhttps, with and withoutwww) in a private window. - Run
curl -Ion the home page and an inner page. You want one 301 straight to the finalhttps://address, not a series of hops. - Check that the padlock shows. If it does not, look for mixed content.
- Clear your cache or test on your phone, because browsers remember redirects.
- In Google Search Console, inspect your HTTPS home page and confirm Google can reach it.
How to stop it coming back
- Keep a note of where the redirect lives (server, CDN or CMS) so it is not duplicated or removed by accident.
- Test again after changing hosts, moving to a new server, switching CDN, rebuilding the site or renewing a certificate. Redirect rules often don't come along with a migration.
- Set the certificate to renew automatically and watch for expiry reminders.
- Use
https://in internal links, your sitemap, canonical tags and social profiles. - Re-check regularly. SiteMonday covers this in week 10 (domain, SSL and email deliverability), and a written report flags it if the redirect is missing. SiteMonday finds and explains the problem, and the fix itself is up to you or your developer.
Step by step for your platform
- HTTP not redirecting to HTTPS on WordPress
- HTTP not redirecting to HTTPS on Nginx
- HTTP not redirecting to HTTPS on Apache
- HTTP not redirecting to HTTPS on Cloudflare
- HTTP not redirecting to HTTPS on cPanel
- HTTP not redirecting to HTTPS on IIS
- HTTP not redirecting to HTTPS on GoDaddy
Questions
Should I use a 301 or a 302 redirect from HTTP to HTTPS?
Use a 301, which tells browsers and search engines the move is permanent. A 302 signals a temporary move and is not what you want here.
Do I need to redirect www as well?
Yes. Test all four versions (http and https, with and without www) and make sure each one ends up at your single preferred https address.
Will redirecting to HTTPS hurt my Google rankings?
A correct one-step 301 should not cause lasting harm, and it removes duplicate versions of your pages. Problems usually come from loops, chains or a broken certificate.
Why do I get 'too many redirects' after enabling HTTPS?
Two layers are usually fighting, for example a CMS setting and a CDN rule, or Cloudflare in Flexible mode while the server also forces HTTPS. Keep one redirect and check the encryption mode.
Is the padlock enough to prove the redirect works?
No. The padlock only shows the page you are on is secure. You still need to test the http:// address to see whether it redirects.
Can I redirect HTTP to HTTPS without a developer?
Often yes, through a switch in your host, CDN or WordPress plugin. If you need to edit server files, take a backup first or ask your host for help.