Redirect HTTP to HTTPS

If you have SSL enabled for your entire site, you will need to make sure that all links pointing to the HTTP version of your site will be automatically redirected to the HTTPS version. You may use one of the following solutions to do this.

Ask your host

Redirects done at the server level will be faster than those done in the htaccess file. The best solution is to your ask your host to set it up for you in the server configuration.

Cloudflare Page Rules

If you use Cloudflare and are comfortable with their Page Rules feature you can use them for redirects (our Support team cannot help you with this).

Helper plugin

The following helper plugin will add the correct redirect rule to your .htaccess file, and make sure that it always remains at the top for maximum efficiency.

📥  Download (.zip): WP Rocket | Redirect HTTP to HTTPS

Developers: You can find the code for this plugin on GitHub.

Heads up!
Only install this plugin yourself if you are comfortable editing files via (S)FTP!

The plugin itself works perfectly well; however, in case something should conflict in your custom environment, you might have remove this plugin manually via (S)FTP and edit .htaccess directly.

These are the rules that the above helper plugin adds to the .htaccess file:

# Redirect HTTP to HTTPS
RewriteEngine On
RewriteCond %{HTTPS} !on
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.