Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 添加查询字符串后,htaccess不工作_Php_Regex_.htaccess - Fatal编程技术网

Php 添加查询字符串后,htaccess不工作

Php 添加查询字符串后,htaccess不工作,php,regex,.htaccess,Php,Regex,.htaccess,我的网址是: http://example.com/test (base url) 我想把这个转变为: https://example.com/tset 如果URL为: http://example.com/test/login?redirect= 我把它改为: https://example.com/test/login?redirect= 如果我的URL是: http://example.com/test/login 我想把它移到: https://example.com/te

我的网址是:

http://example.com/test  (base url)
我想把这个转变为:

https://example.com/tset 
如果URL为:

http://example.com/test/login?redirect=
我把它改为:

https://example.com/test/login?redirect=
如果我的URL是:

http://example.com/test/login
我想把它移到:

https://example.com/test/login

您可以将此规则用作站点根目录中的第一条规则。htaccess:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^bt\. [NC]
RewriteCond %{HTTPS} !on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

查询字符串自动结转到
https://....
URL.

您能显示您尝试的规则吗?RewriteCond%{HTTP_HOST}^bt.example.com/test/(.*)[NC]RewriteRule[R,L]实际上无法使用此规则,因为我已将另一个站点指向同一文件夹。如果我应用此规则,则它将在两个站点上都起作用。这就是为什么我需要站点特定的会话和规则