apache - 如何在 htaccess 中仅删除一个 .php 文件的 https 重定向
问题描述
我只想为一个 .php 文件删除我的网页的 https 重定向。我找到了这个,但我不知道如何设置我的 .php 方向。提前致谢
.php 文件 = www.myhost.com/myphp.php
# force http:// for selected URLs
RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} /commerce_paypal/ [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
解决方案
你的情况发生了逆转。你需要使用这个:
# force https:// to all but selected URLs
RewriteCond %{HTTPS} !on
RewriteCond %{THE_REQUEST} !\s/+myfile\.php [NC]
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# force http:// to selected URLs
RewriteCond %{HTTPS} on
RewriteCond %{THE_REQUEST} \s/+myfile\.php [NC]
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
推荐阅读
- ios - 防止 UINavigationBar 在 UITableView 滚动 iOS 11 上增长
- javascript - decodeString:正则表达式解决方案
- angularjs - 验证所需的 ui-select 字段
- javascript - HTML 文本与方向 rtl 左对齐
- netlogo - 如何按标签查找海龟并获取其 WHO 值?
- javascript - MomentJS isAfter 在包含天数时不起作用
- javascript - 尝试为 Discord bot 提供多个命令文件
- hibernate - 如何为 OneToOne 生成 hql 查询
- javascript - Microsoft Graph CompactToken 解析失败,错误代码:8004920A
- url - 在 winapi 中获取 URL 部分