Direct Answer
Domains you redirect with RedirHub need no HTTP-to-HTTPS rule: RedirHub answers both http:// and https:// and sends both to your destination. For a website you host yourself, add one permanent (301) rule at the server or CDN that sends http:// to the same URL on https://, and combine it with your www rule so visitors get a single hop.
| Item | Details |
|---|---|
| Goal | Every http:// URL answers with a 301 to the same URL on https:// |
| You need | A valid certificate on the HTTPS side, and access to your server, CDN or CMS settings |
| Redirect type | 301 Permanent |
On a domain you redirect with RedirHub#
Nothing to set up. Once the domain's DNS points to RedirHub, a certificate is issued automatically and http://old-site.com/page and https://old-site.com/page are both redirected to your destination in one hop. See Automatic HTTPS.
On your own website#
Install the certificate first and check that https:// works. Then add one of these rules.
Apache (.htaccess)#
apacheRewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]Nginx#
nginxserver {
listen 80;
server_name example.com www.example.com;
return 301 https://$host$request_uri;
}Cloudflare#
In SSL/TLS, open Edge Certificates and turn on Always Use HTTPS. Set the SSL/TLS mode to Full (strict) when your origin has a valid certificate; Flexible mode together with an HTTPS rule on the origin causes a redirect loop.
WordPress#
In Settings, General, change WordPress Address and Site Address to https://, then add the server rule above. Changing the addresses alone doesn't redirect old http:// links.
Avoid two hops when you also redirect www#
If http://example.com first goes to https://example.com and then to https://www.example.com, that is a chain. Write the rule so http:// and the non-canonical host go straight to the final URL, or let RedirHub handle the host you redirect away from; see Redirect non-www to www.
Result#
| Request | Response | Lands on |
|---|---|---|
| http://www.example.com/pricing | 301 | https://www.example.com/pricing |
| http://example.com/pricing | 301 | https://www.example.com/pricing (one hop) |
| https://www.example.com/pricing | 200 | The page itself |
Check your HTTPS redirect Trace http://yourdomain.com and see every hop, its status code and whether HTTPS is valid.
Open the Redirect CheckerFrequently asked questions
A 301. The move to HTTPS is permanent, and a 301 tells search engines to index the https:// URL.
Yes. RedirHub answers http:// and https:// for every domain that points to it and redirects both to the destination.
Usually a CDN in Flexible SSL mode talks HTTP to your server while the server redirects to HTTPS. Use Full (strict) mode, or remove one of the two HTTPS rules.
