我如何将 .htaccess 文件写入https://www.domain.com 示例:
domain.com => https://www.domain.com
www.domain.com => https://www.domain.com
https://domain.com => https://www.domain.com
http://www.domain.com => https://www.domain.com
这是我的 htaccess:
# Use PHP5.4 Single php.ini as default
AddHandler application/x-httpd-php54s .php
<IfModule mod_rewrite.c>
# For security reasons, Option followsymlinks cannot be overridden.
# Options +FollowSymLinks
Options +SymLinksIfOwnerMatch
Options +Indexes
RewriteEngine On
RewriteCond %{http_host} ^mydomain\.com [NC]
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,NC]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]
RewriteCond %{REQUEST_FILENAME}.php -f
</IfModule>
# BEGIN WordPress
# END WordPress
我添加下一个代码:
<IfModule mod_rewrite.c>
# add https to domain.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</IfModule>
但我的域仍然是 www.domain.com 而不是https://www.domain.com。我应该改变什么?
非常感谢。