如何在PHP中更改搜索页面网址 [英] How do I change search page url in PHP

查看:79
本文介绍了如何在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]


这篇关于如何在PHP中更改搜索页面网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆