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
Apache 在url中使用brakets创建htaccess规则_Apache_.htaccess_Mod Rewrite - Fatal编程技术网

Apache 在url中使用brakets创建htaccess规则

Apache 在url中使用brakets创建htaccess规则,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,我正在尝试为以下URL创建重定向规则 https://www.mywebsite.com/catalogsearch/advanced/result/?category=39&price%5bfrom%5d=8000&price%5bto%5d=10000 我使用以下规则 RewriteCond %{QUERY_STRING} ^category=39&price\[from\]=8000&price\[to\]=10000 RewriteRule ^c

我正在尝试为以下URL创建重定向规则

https://www.mywebsite.com/catalogsearch/advanced/result/?category=39&price%5bfrom%5d=8000&price%5bto%5d=10000
我使用以下规则

    RewriteCond %{QUERY_STRING} ^category=39&price\[from\]=8000&price\[to\]=10000
RewriteRule ^catalogsearch/advanced/result/ https://www.mywebsite.com/my-new-page [L,R=301]
我在这个网站上测试了这个规则

以及它在测试仪上的工作。但这条规则在我的网站上不起作用。 我的规则出了什么问题?我应该怎么做才能解决它

提前感谢。

试试:

RewriteCond %{QUERY_STRING} ^category=39&price\x5bfrom\x5d=8000&price\x5bto\x5d=10000
RewriteRule ^catalogsearch/advanced/result/ https://www.mywebsite.com/my-new-page [L,R=301]
或与:

RewriteCond %{QUERY_STRING} ^category=39&price\x255bfrom\x255d=8000&price\x255bto\x255d=10000

不,它不起作用。很抱歉此外,我还将该规则移到了htaccess的开头,因此我确信它不会被另一个规则覆盖。如果您试图清除缓存或更改浏览器(因为R=301使用缓存),我只是在firefox上尝试过。当您第一次加载url时,它会将参数转换为“?category=39&price[from]=8000&price[to]=10000”,然后如果您刷新它,它将被重定向到“我的新页面”。但我的第二个和新的
RewriteCond
仍然无法进行色度测定,它确实起作用了。谢谢你。你能详细说明它是如何修复的吗?