【发布时间】:2016-12-16 17:57:42
【问题描述】:
目前,我在论坛站点的 .htaccess 文件中有以下内容。
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com [NC]
RewriteRule ^/?$ http://example.com/forums/ [L,R=301]
它非常适合将 (http)://example.com、www.example.com、(http)://www.example.com 等所有内容重定向到 example.com/forums,这正是我想要的.
我现在希望将所有内容重定向到 (https)://example.com/forums,但在使用现有链接(例如 example.com/forums/stuff)时遇到了问题。
我只能让example.com重定向到https://example.com/forums,任何直接链接,例如example.com/forums/stuff等都不会重定向到https版本,有什么想法吗?
【问题讨论】:
-
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]?
标签: .htaccess redirect mod-rewrite