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
.htaccess htaccess重写规则应该如何执行?_.htaccess_Getparameter - Fatal编程技术网

.htaccess htaccess重写规则应该如何执行?

.htaccess htaccess重写规则应该如何执行?,.htaccess,getparameter,.htaccess,Getparameter,示例地址:mysite.com/search/?q=笔记本 我的重写规则 RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ example.php?param1=$1&param2=$2 此规则忽略?q=个字符。 htaccess重写规则应如何接受此特殊字符?看起来您只是QSA标记: RewriteRule ^([\w-]+)/([\w-]+)$ example.php?param1=$1&param2=$2 [L,QSA] Q

示例地址:mysite.com/search/?q=笔记本

我的重写规则

RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ example.php?param1=$1&param2=$2
此规则忽略
?q
=个字符。
htaccess重写规则应如何接受此特殊字符?

看起来您只是
QSA
标记:

RewriteRule ^([\w-]+)/([\w-]+)$ example.php?param1=$1&param2=$2 [L,QSA]
  • QSA
    (查询字符串附加)标志在添加新查询参数时保留现有查询参数
也许您需要使用?(只是猜测,因为问题描述不太清楚。)