Cara Redirect domain dari http ke https di Script Codeigniter

Untuk memaksakan HTTPS terlebih dahulu, Anda harus memeriksa variabel lingkungan yang benar %{HTTPS} off, tetapi aturan Anda di atas kemudian menambahkan. www.Karena Anda memiliki aturan kedua yang harus ditegakkan www., jangan menggunakannya dalam aturan pertama

RewriteEngine On
RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
# [NC] is a case-insensitive match
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
  • Share:

ARTIKEL TERKAIT

1 COMMENTS

Sushi By 7-11, 01 Jun 2019 20:39:51

Hello to every body, it's my first visit of this website; this web site carries awesome and genuinely fine information in support of readers.

LEAVE A COMMENT