【发布时间】:2016-06-27 19:53:10
【问题描述】:
在 Apache 的 httpd.conf 文件中,如何重写模块以使 url 的 www 为非 www 并强制 http 为 https? 当我在下面尝试时,它变成了无限重定向错误
RewriteCond %{HTTP_HOST} ^www.(.*)$
RewriteRule ^(.*)$ https://example.com$1
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ https://example.com$1
或
RewriteCond %{HTTP_HOST} ^www.(.*)$ [OR]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)$ https://example.com$1
【问题讨论】:
标签: redirect mod-rewrite rewrite httpd.conf url-rewrite-module