.htaccess 仅从特定url删除https(ssl)

.htaccess 仅从特定url删除https(ssl),.htaccess,mod-rewrite,.htaccess,Mod Rewrite,我只想删除特定url的安全http: https://www.example.com/car-sharing.html 应该重定向到 http://www.example.com/car-sharing.html 例如,我尝试了几个.htaccess指令 RewriteCond %{HTTPS} on RewriteCond $1 ^(car-sharing\.html) RewriteRule (.*) http://%{HTTP_HOST}%$1 [R=301,L] 或 但我无法让它工

我只想删除特定url的安全http:

https://www.example.com/car-sharing.html
应该重定向到

http://www.example.com/car-sharing.html
例如,我尝试了几个.htaccess指令

RewriteCond %{HTTPS} on
RewriteCond $1 ^(car-sharing\.html)
RewriteRule (.*) http://%{HTTP_HOST}%$1 [R=301,L]


但我无法让它工作,从https重定向到http从未发生过。非常感谢您的帮助。

%{REQUEST\u URI}
包含前导斜杠,因此应该可以:

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/car-sharing.html
RewriteRule ^ http://www.example.com%{REQUEST_URI} [R=301,L,QSA]

如何处理https重定向?你说“不能工作”是什么意思<代码>%$1语法无效,但不会转储错误。感谢您的评论。重定向没有发生-这就是我的意思,我无法让它工作顺便问一下,你打开了重写引擎吗
RewriteEngine on
需要处于规则的顶部。@PanamaJack如果不是这样,它不会导致500错误吗?
RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} ^/car-sharing.html
RewriteRule ^ http://www.example.com%{REQUEST_URI} [R=301,L,QSA]