力HTTP,而不是HTTPS只为一个特定的文件 [英] force http instead of https only for a particular file

查看:157
本文介绍了力HTTP,而不是HTTPS只为一个特定的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于一个特定的文件,我想迫使http来代替https

For a particular file, I want to force http instead of https

例如:

https://example.com/test.php?parameter1=value1

应该发送到

http://example.com/test.php?parameter1=value1

我怎样才能做到这一点?

How can I achieve this?

推荐答案

您的问题不是很清楚,但试试这个的.htaccess code:

Your question is not very clear but try this .htaccess code:

Options +FollowSymLinks -MultiViews
RewriteEngine on

RewriteCond %{QUERY_STRING} ^parameter1=.*$ [NC]
RewriteCond %{HTTPS} !=on
RewriteRule ^test\.php/?$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA,NC]

这将重定向只有当查询字符串参数1 =东西是present在原来的网址。如果你想重定向所有 /test.php 的URI为https然后取出1号线的RewriteCond

This will redirect ONLY if QUERY string parameter1=something is present in the original URL. If you want to redirect all /test.php URIs to https then remove the 1st RewriteCond line.

这篇关于力HTTP,而不是HTTPS只为一个特定的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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