强制https除一个目录 [英] Force https except for one directory

查看:155
本文介绍了强制https除一个目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下.htaccess文件强制任何页面请求https://

I'm using the following .htaccess file to force any page request to https://

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

除了目录/ domain之外,我怎么能强制https用于所有目录/页面?

How could I force https for all directories/pages except the directory "/domain" ?

我可以改变主要的htacces或在/ domain目录中创建一个新的,简单的方法,但是如何?

I can change the main htacces or create a new one in the /domain directory, the easy way, but how?

推荐答案

这应该得到什么你需要。

This should get what you need.

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !domain [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

这篇关于强制https除一个目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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