带有异常的mod_rewrite [英] mod_rewrite with exceptions

查看:68
本文介绍了带有异常的mod_rewrite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

用于将服务器上的每个请求重定向到我使用的安全连接

For redirecting every request on my server to a secure connection I use

RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://mywebsite.com/$1 [R,L]

效果很好.

但是,我需要不重定向两个路径.

However I need two paths not to be redirected.

访问时说

http://www.mywebsite.com/page1/test
http://www.mywebsite.com/page2

我想精确地走那条路.可以使用mod_rewrite吗?

I want to go to exactly that path. Is that possible with mod_rewrite?

推荐答案

尝试如下操作:

RewriteCond %{SERVER_PORT} 80 
RewriteCond %{REQUEST_URI} !/page1/test
RewriteCond %{REQUEST_URI} !/page2
RewriteRule ^(.*)$ https://mywebsite.com/$1 [R,L]

这篇关于带有异常的mod_rewrite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆