【发布时间】:2016-03-22 15:14:13
【问题描述】:
我有这段代码可以强制任何 URL 为“https://www。”:
#rewrite to WWW:
RewriteCond %{HTTP_HOST} !^(\d+)
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
#Now, rewrite to HTTPS:
RewriteCond %{HTTP_HOST} !^(\d+)
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
我有子域,我不希望它们中的任何一个被重定向。我能做什么?
【问题讨论】:
-
也许你认为这是重复的,但没有任何问题同时包含 www 和 https 重定向
标签: regex linux apache .htaccess mod-rewrite