【发布时间】:2011-05-25 22:41:19
【问题描述】:
我有两个虚拟主机设置到服务器上的同一目录。一个监听 80 端口,另一个监听 443。
我有 3 个文件
index.html
secure.html
view.html
每个文件都有一个菜单:
<ul>
<li><a href="index.html">Index</a></li>
<li><a href="secure.html">secure</a></li>
<li><a href="view.html">view</a></li>
</ul>
我想设置重定向,使其满足以下条件:
http://localhost/secure.html - 转到https://localhost/secure.html
http://localhost/index.html - 转到http://localhost/index.html
http://localhost/view.html - 转到http://localhost/view.html
https://localhost/index.html - 转到http://localhost/index.html
https://localhost/view.html - 转到http://localhost/view.html
当我在
https://localhost/secure.html 并点击
索引将我带到http://localhost/index.html
查看将我带到http://localhost/view.html
我怎样才能做到这一点?
我知道我必须将这些放在 .htaccess 文件中,但我不知道如何定义这些条件,
【问题讨论】:
-
属于serverfault。
标签: mod-rewrite ssl redirect https apache2