We have a site that somehow has both http and https versions accessible. We want to force it all to https. When we try to set the WordPress and Site URLS to https the site ends up in a redirect loop.

Using Really Simple SSL doesn't really help as we still end up with a redirect loop.

Redirection plugin isn't doing anything that would cause this.

I didn't even know you could get a WordPress site to display both versions, let alone how one would go about changing this.

Googling/searching Stack exchange for this is rather difficult for obvious reasons, so I apologize if this has been answered somewhere else.

Has anyone seen this issue before?


If you can access the SSL version of your blog without a problem, then it means you can redirect all your traffic to it. To do so, take these 2 steps:

  1. Access your database using PhpMyAdmin or any other software you want. Head over to wp_options table, and change to values of siteurl and homeurl to SSL version of your blog (for example https://example.com).

  2. Using any FTP software open and edit your .htaccess file the following way:

This will redirect all traffics to the secure version of your blog.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

#BEGIN WordPress
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Remember not to remove the original rules created by WordPress (the lines below #BEGIN WordPress)

| improve this answer | |
  • I actually used a slightly different version as yours was creating a redirect loop for some reason. RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] – zfors Jun 24 at 15:39

Jack Johansson have answered you rightly! Alternative to this you could also install "WordPress Force HTTPS" plugin to do this without messing up with .htaccess

Note: Don't forget to install Cloudflare plugin if in case you are using cloudflare else your site will enter into infinite redirect loop.

| improve this answer | |
  • 1
    downvotedt as link only answers are not good answers (seriously that plugin is 5 lines of code.... you could have just included it) and it is very likely that it will cause endless redirects which is the problem the OP has with otherplugins. – Mark Kaplun Apr 30 '17 at 2:56
  • There are many cases where the admin may not access the root directory or edit the .htaccess file. In this case plugin works best. – Disk01 May 1 '17 at 14:02
  • I am mystified, how an admin can be an admin without having access to change files? and what does it have to do with the fact that answers should include code not links? – Mark Kaplun May 1 '17 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.