如何将查询参数附加到新的URL?

时间:2019-04-15 06:11:04

标签: wordpress

我正在尝试解决wordpress搜索问题(只想显示来自博客文章的搜索结果)

要解决以上问题,我正在尝试在网址中添加&post_type = post

例如:

www.example.com/?s=search 

www.example.com/?s=search&post_type=post 

我正在尝试使用htaccess更改搜索网址

RewriteCond %{QUERY_STRING} \\?s=([^&]+) [NC]
RewriteRule ^$ /search/%1/?(.+?)&post_type=post [NC,R,L]

但是上面的代码不起作用

0 个答案:

没有答案