简体   繁体   English

apache将所有URL重写为HTTPS(除了一个)

[英]apache rewrite all URLs to HTTPS except for one

I have a website that I'm directing all non SSL traffic to use the https protocol. 我有一个网站,我正在指导所有非SSL流量使用https协议。

I've used 我用过

RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

This works great, but I need the url 这很好用,但我需要网址

http://www.mywebsite.com/update-db.php 

to not follow this rule. 不遵守这个规则。

How can I do this? 我怎样才能做到这一点?

Here is an example where I need to redirect my downloads for IE8 because it has a bug when using SSL. 这是一个示例,我需要重定向我的IE8下载,因为它在使用SSL时存在错误。 Just take out the RewriteCond %{HTTP_USER_AGENT} ^(. )MSIE\\ 8.(. )$ [NC] and replace viewpdf with your php file in your case. 只需取出RewriteCond%{HTTP_USER_AGENT} ^(。 )MSIE \\ 8。(。 )$ [NC],然后将viewpdf替换为您的php文件。

RewriteEngine On
#Fix for IE8 SSL Bug downloading PDF
RewriteCond %{HTTPS} on
RewriteCond %{HTTP_USER_AGENT} ^(.*)MSIE\ 8\.(.*)$ [NC]
RewriteCond %{REQUEST_URI} ^/(viewpdf.*)$ [NC]
RewriteRule ^/?(viewpdf.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [L,NC]

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/(viewpdf.*)$ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L]

Simply just: 只是:

RewriteCond %{REQUEST_URI} !^/update-db.php$
RewriteCond %{HTTPS} off
RewriteRule ^(.*) https://%{HTTP_HOST}%{REQUEST_URI}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM