如何在PHP中更改搜索页面网址
问题描述:
我想更改搜索页面的网址。
例如,如果有人在我的网站上搜索,那么URL就是
https://myweb.com/search.php?search=searched-keyword
我想把它改成类似
https://myweb.com/search/searched-keyword
如何使用PHP或.htaccess文件执行此操作
我尝试过:
我已经在我的.htaccess中使用了它但它对我不起作用...
I want to change the URL of a search page.
For Example, if someone searches on my website then the URL is
https://myweb.com/search.php?search=searched-keyword
I want to change it to something like
https://myweb.com/search/searched-keyword
How do I do this using PHP or .htaccess file
What I have tried:
I have used it in my .htaccess but it didn't work for me...
RewriteEngine On
RewriteRule ^search.php?search=(.*)$ https://myweb.com/search$1 [L,R=301]
答
https:/ /myweb.com/search
https://myweb.com/search
1 [L,R = 301]
1 [L,R=301]