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_Url Rewriting_Rewrite - Fatal编程技术网

.htaccess 用多个参数重写规则?

.htaccess 用多个参数重写规则?,.htaccess,url-rewriting,rewrite,.htaccess,Url Rewriting,Rewrite,我正在尝试通过转换来重写URL http://domain.com/sitemap.php?category=car&month=10&date=30 到 我尝试了以下规则: RewriteRule ^sitemap-([a-z]+)-([0-9]+)-([0-9]+).xml$ sitemap.php?category=$1&month=$2&date=&3 [L] 我无法让它工作。我做错了什么?我怎样才能让它工作呢 谢谢 您必须在重写结束时使用

我正在尝试通过转换来重写URL

http://domain.com/sitemap.php?category=car&month=10&date=30

我尝试了以下规则:

RewriteRule ^sitemap-([a-z]+)-([0-9]+)-([0-9]+).xml$ sitemap.php?category=$1&month=$2&date=&3   [L]
我无法让它工作。我做错了什么?我怎样才能让它工作呢

谢谢

您必须在重写结束时使用[QSA]标志。QSA代表查询字符串追加。在重写结束时,你还出现了一个打字错误,你写了3英镑而不是3美元:


规则看起来不错,什么不起作用?您还有其他规则吗?没有,当您使用原始URL中的查询字符串重写时,请使用[QSA],而不是在本例中。
RewriteRule ^sitemap-([a-z]+)-([0-9]+)-([0-9]+).xml$ sitemap.php?category=$1&month=$2&date=&3   [L]
RewriteRule ^sitemap-([a-z]+)-([0-9]+)-([0-9]+).xml$ sitemap.php?category=$1&month=$2&date=$3   [L,QSA]