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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/backbone.js/2.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
wordpress中用于搜索查询的URL重定向_Wordpress_.htaccess_Redirect_Plugins - Fatal编程技术网

wordpress中用于搜索查询的URL重定向

wordpress中用于搜索查询的URL重定向,wordpress,.htaccess,redirect,plugins,Wordpress,.htaccess,Redirect,Plugins,我是Wordpress的新手,使用这个插件进行重定向 我想以如下方式重定向搜索查询 www.mywebsite.com/?s=abcd 被重定向到 www.mywebsite.com/?s=abcd&r\u sortby=最高评级 有谁能帮助我如何使用上述插件、htaccess或任何其他插件实现这一点 我试着用正则表达式来解决这个问题,但可能我做错了。这是一件不用正则表达式或插件就可以做到的事情 因为您发布的url似乎是按最高评级对搜索结果进行排序,所以您需要做的唯一一件事就是添加一个隐藏的输

我是Wordpress的新手,使用这个插件进行重定向

我想以如下方式重定向搜索查询

www.mywebsite.com/?s=abcd

被重定向到

www.mywebsite.com/?s=abcd&r\u sortby=最高评级

有谁能帮助我如何使用上述插件、htaccess或任何其他插件实现这一点


我试着用正则表达式来解决这个问题,但可能我做错了。

这是一件不用正则表达式或插件就可以做到的事情

因为您发布的url似乎是按最高评级对搜索结果进行排序,所以您需要做的唯一一件事就是添加一个隐藏的输入,其名称为=r_sortby,值为=highest_rated

例如:

<form name="searchform" role="search" method="GET" action="<?php echo home_url( '/' ); ?>">
<input type="text" value="<?php echo get_search_query(); ?>" name="s" id="s" />
<input type="hidden" name="r_sortby" value="highest_rated" />
<input type="submit" name="submit" value="submit" />
</form>