How to move WordPress form HTTP to HTTPS

前端 未结 1 1649
有刺的猬
有刺的猬 2020-12-21 20:14

I have following code in my .htaccess file of a wp site

# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\\.         


        
相关标签:
1条回答
  • 2020-12-21 20:33

    The problem is that you're not checking if https is being used, so it just constantly tells the browser to go to https://www.yoursite.com/$1.

    You can use %{HTTPS} to check whether the request uses https.

    RewriteEngine on
    RewriteCond %{HTTPS} !^on$ [NC]
    RewriteRule ^(.*)$ https://www.yoursite.com/$1 [L,R=301,NC]
    
    0 讨论(0)
提交回复
热议问题