重定向到 HTTPS,但一系列 URL 除外



我需要在一系列网址上推迟https...

现在我得到了这个:https://sub.domain.com/release/download/{id}

我需要将所有/release/download/{id} 网址重定向到 http

我从这里尝试了几种解决方案:Mod_rewrite http->https 重定向,除了一个网址

但没有一个奏效。

我在我的 apache conf 中得到了这个:

RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]
您可以使用

以下重写规则

RewriteEngine On
#redirect http to https except "/release/download/*
RewriteCond %{REQUEST_URI} !^/release/download/.*
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}$1 [R=301,L]

最新更新