Gop*_*opu 1 .htaccess ssl redirect
我有一个域example.com并为www.example.com安装了SSL.我想为以下规则创建一个htaccess文件:
Redirect all traffic from http://example.com to https://www.example.com
Redirect all traffic from http://www.example.com to https://www.example.com
Run Code Online (Sandbox Code Playgroud)
你想在你的文档根目录中的htaccess文件中找到这样的东西,最好是那些可能已存在的规则.
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^ https://www.example.com%{REQUEST_URI} [L,R=301]
Run Code Online (Sandbox Code Playgroud)