服务器向查询字符串添加额外参数
Server Adding Extra Parameters to Query String
我尝试使用不同的框架,从自定义构建到 PhalconPHP。
似乎有时,在某些服务器上,当有特定参数值时,服务器会向查询字符串添加额外的参数。
这发生在 index
字词上。
例如,如果 URL 是这样的; http://example.com/index
当我转储 $_GET
值时,我得到了这个;
array(1) {
["_url"]=>
string(29) "/redirect:/public/index.html/"
}
然而,任何其他不以 index
开头的 URL 值都会按预期运行。例如,当我为 http://example.com/my-page
转储 $_GET
时
我明白了;
array(1) {
["_url"]=>
string(29) "/my-page"
}
我的.htaccess
AddDefaultCharset UTF-8
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
# CloudFlare SSL
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)$ https://%{SERVER_NAME}/ [L]
# Redirect WWW to NON-WWW
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/ [R=301,L]
# Public Root
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/ [L]
</IfModule>
我用谷歌搜索并检查了 SOF 的解决方案,但我没那么幸运。
任何帮助将不胜感激。
这通常是 MultiViews 的“错误”。
尝试通过添加
禁用它
Options -MultiViews
到您的 .htaccess。
有关此主题的更多信息,请查看
http://httpd.apache.org/docs/2.2/en/mod/core.html#options
http://httpd.apache.org/docs/2.2/en/content-negotiation.html#multiviews
我尝试使用不同的框架,从自定义构建到 PhalconPHP。
似乎有时,在某些服务器上,当有特定参数值时,服务器会向查询字符串添加额外的参数。
这发生在 index
字词上。
例如,如果 URL 是这样的; http://example.com/index
当我转储 $_GET
值时,我得到了这个;
array(1) {
["_url"]=>
string(29) "/redirect:/public/index.html/"
}
然而,任何其他不以 index
开头的 URL 值都会按预期运行。例如,当我为 http://example.com/my-page
转储 $_GET
时
我明白了;
array(1) {
["_url"]=>
string(29) "/my-page"
}
我的.htaccess
AddDefaultCharset UTF-8
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine on
# CloudFlare SSL
RewriteCond %{HTTP:CF-Visitor} '"scheme":"http"'
RewriteRule ^(.*)$ https://%{SERVER_NAME}/ [L]
# Redirect WWW to NON-WWW
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/ [R=301,L]
# Public Root
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/ [L]
</IfModule>
我用谷歌搜索并检查了 SOF 的解决方案,但我没那么幸运。 任何帮助将不胜感激。
这通常是 MultiViews 的“错误”。
尝试通过添加
禁用它Options -MultiViews
到您的 .htaccess。
有关此主题的更多信息,请查看
http://httpd.apache.org/docs/2.2/en/mod/core.html#options
http://httpd.apache.org/docs/2.2/en/content-negotiation.html#multiviews