Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/flutter/9.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
.htaccess 将查询字符串转换为seo友好url,但允许其他查询字符串_.htaccess_Query String - Fatal编程技术网

.htaccess 将查询字符串转换为seo友好url,但允许其他查询字符串

.htaccess 将查询字符串转换为seo友好url,但允许其他查询字符串,.htaccess,query-string,.htaccess,Query String,我在.htaccess中有此代码: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/\.]+)$ product.php?slug=$1 [NC,L] 我想要这样的东西,URL: domain.com/products/product.php?slug=product name&search=test 要使其在此地址工作,请执行以下

我在.htaccess中有此代码:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/\.]+)$ product.php?slug=$1 [NC,L]
我想要这样的东西,URL:
domain.com/products/product.php?slug=product name&search=test
要使其在此地址工作,请执行以下操作:
domain.com/products/product name?search=test

现在它几乎可以正常工作了,但当我在php中检查此项时,搜索查询不起作用:
if($\u SERVER['REQUEST\u METHOD']=='GET'&&!empty($\u GET['search'])

添加
QSA
标志:
RewriteRule^([^/]+)/?$product.php?slug=$1[QSA,L]
@anubhava工作正常,谢谢!