Ta có thể sử dụng 1 trong các đoạn mã sau để ở dưới RewriteEngine on nhé


Đoạn nên xài
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

 

RewriteCond %{HTTP_HOST} ^example.co.uk [NC] 
RewriteRule ^(.*)$ https://example.co.uk/$1 [L,R=301]


 
RewriteCond %{SERVER_PORT} ^80$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]


RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R,L]


ewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}


Đối với wordpres
 
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


 


Rated: 3.0/5 - (2 phiếu)
2019-07-16
2019-06-26