• Siddharth

    (@siddy1705)


    Hello,

    I am new to WordPress. I am using W3TC on my WP website and the plugin has added a bunch of code in my HTACCESS file.
    Now i have added an SSL certificate and want to add a redirect code in HTACCESS on my site for redirecting from HTTP to HTTPS. The code is:

    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

    I tried to load my site after adding this code and it gives an error message that the site is redirecting too many times.

    I made a replica of that site on my local instance removed the W3TC which is working fine.

    Please let me know if that is happening because of the redirect code in W3TC and if yes, is there any way to tackle that?

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • amsgator

    (@amsgator)

    Did you update your wordpress settings to https? If not it’s probably redirecting back and forth between http from wordpress and https from htaccess. If you have try:

    RewriteEngine On
    RewriteCond %{HTTPS} !on [NC]
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    • This reply was modified 8 years ago by amsgator.
    Thread Starter Siddharth

    (@siddy1705)

    @amsgator Thank you for the reply.

    I tried it but it still happening the same. I changed the website URL from WP settings to HTTPS and also added the given code.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problem while redirecting from HTTP to HTTPS’ is closed to new replies.