Chuyển http sang https bằng htaccess

Chuyển http sang https bằng htaccess
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 %{SERVER_PORT} ^80$ 
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]  

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://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]


 
CSKH 24/7
(028)66 82 82 99
Kỹ thuật 247
0968 592 399

Tư vấn 1
0939 861 299
Tư vấn 2
0919 383 299
Gọi
 Sales
 Sales
 Tech