htaccess redirect to https://www

前端 未结 14 2053
夕颜
夕颜 2020-11-21 11:01

I have the following htaccess code:



RewriteEngine On
RewriteCond !{HTTPS} off
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{RE         


        
14条回答
  •  梦毁少年i
    2020-11-21 11:47

    I try first answer and it doesnt work... This work:

    
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{ENV:HTTPS} !=on
    RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
    
    # BEGIN WordPress
    
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    
    
    # END WordPress
    

提交回复
热议问题