HTTPS Force Redirect not working in Wordpress

前端 未结 2 1621
梦谈多话
梦谈多话 2021-02-01 07:39

My Wordpress directory is at www.example.com/blog

I recently changed my entire site to force HTTPS. So my .htaccess file in /blog/ looks like this:



        
2条回答
  •  深忆病人
    2021-02-01 08:26

    Change the order of the rules. First redirect to https and then let WP take over all of your requests.

    
    RewriteEngine On
    
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    
    RewriteBase /blog/
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /blog/index.php [L]
    
    

提交回复
热议问题