Apache 强制 HTTPS

就是利用 .htaccess 将 HTTP 协议跳转到对应 HTTPS 协议。

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

参考:

  1. https://www.siteground.com/kb/how-to-force-ssl-with-htaccess/
  2. https://www.ironistic.com/how-to-force-https-ssl-using-the-htaccess-file/

作者: YanWen

Web 开发者

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s