Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/235.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/5.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 从http重定向到https,但在新结果中显示变量_Php_.htaccess - Fatal编程技术网

Php 从http重定向到https,但在新结果中显示变量

Php 从http重定向到https,但在新结果中显示变量,php,.htaccess,Php,.htaccess,我正在.htaccess文件中使用重定向 RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301] 在我看到重定向显示变量之前,似乎工作正常。 示例页 当我只在重定向之前使用htt

我正在.htaccess文件中使用重定向

RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301]
在我看到重定向显示变量之前,似乎工作正常。 示例页 当我只在重定向之前使用http时,添加的重定向效果很好。 但现在显示类似于

知道如何确保它不放入这些变量吗?

尝试添加QSD标志(放弃查询字符串)


在htaccess中重写之前添加重定向规则。然后清除浏览器缓存以测试该规则。Musa:QSD将放弃从所有http到https URL的查询字符串。我不认为这是OP想要的。
RewriteRule ^ https://www.%1%{REQUEST_URI} [QSD,L,NE,R=301]