2

There are quite a few threads going on regarding this but they all seem to say the same thing (which I tried) but I keep getting a redirect loop. I already tried changing the WordPress Address (URL) and Site Address (URL) in the General settings (my admin panel is already on https)

My .htaccess looks like:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On

# start https redirect
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# end https redirect

RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

Anyone an idea?

0

I'd steer clear on editing the .htaccess if you're just updating your website from HTTP to HTTPS. Try an alternative route:

First, revert your .htaccess back to the default settings:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Next, you need to ensures that all of the URLs for your website are up-to-date, try the following steps using the Search Replace DB tool:

  1. Go and download Interconnect IT's Database Search & Replace Script here
  2. Unzip the file and drop the folder in your localhost where your WordPress is installed (the root) and rename the folder to replace (screenshot)
  3. Navigate to the new folder you created in your browser (ex: http://web.site/replace) and you will see the search/replace tool
  4. It should be pretty self-explanatory up to this point: enter your HTTPS link in the search for… field and the new HTTPS link in the replace with… field

You can click the dry run button under actions to see what it will be replacing before you execute the script. Once you're done be sure to remove the /replace/ folder.

However...

If you still insist on having your HTTP redirect to HTTPS via the .htaccess add the following in between the <IfModule mod_rewrite.c> tag:

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

It should look like the following:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# Rewrite HTTP to HTTPS
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*) https://%{SERVER_NAME}/$1 [R,L]
</IfModule>
# END WordPress
-1

Can you try this?

# BEGIN WordPress

RewriteEngine On

# start https redirect
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# end https redirect

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


# END WordPress
  • thanks but your suggestion does not do anything (no redirect to https but also doesn't break anything) – Vincent Aug 8 '16 at 14:51
  • Ok, Can you try by moving "RewriteBase /" line above to https code and below to "RewriteEngine On". – Tejas Dixit Aug 10 '16 at 6:38
  • Doesn't seem to be doing anything :( – Vincent Aug 11 '16 at 7:29

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.