【发布时间】:2017-05-10 16:09:22
【问题描述】:
我想将所有可能的 url 组合重定向到单个路径。
例如。
http:/example.com ---> https:/example.com/abc/cde
https:/example.com --> https:/example.com/abc/cde
http:/example.com/abc/cde --> https:/example.com/abc/cde
我可以通过遵循 mod_rewrite 设置来处理 1 和 3 的情况,但不能执行 2 重定向可以帮助一些人。
为了避免链接转换,我在网站示例中使用了一个 /。
重写引擎开启
RewriteCond %{HTTPS} 关闭
RewriteCond %{HTTP:X-Forwarded-Proto} !https
重写规则 ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
【问题讨论】: