这是 url 重写不起作用

发布于 2024-09-27 08:39:02 字数 349 浏览 0 评论 0原文

我尝试创建此 url 规则但不起作用:我不知道为什么 :(

原始 url

www.example.com/viewprofile.php?username=jhon

所需的友好 url 是

www.example.com/user/jhon

这是 my.htaccess 代码:

RewriteEngine On
RewriteRule ^username/([^/]*)$ /viewprofile.php?username=$1 [L]

感谢您的帮助!!:))

i tried to create this url rule buts not working: i dont know why :(

orginal url

www.example.com/viewprofile.php?username=jhon

the desired friendly url is

www.example.com/user/jhon

this is my.htaccess code:

RewriteEngine On
RewriteRule ^username/([^/]*)$ /viewprofile.php?username=$1 [L]

thanks for helping!! :))

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

两个我 2024-10-04 08:39:02

我发现这个教程的作者一步步解释了如何准确地完成您想要做的事情。看看是否有帮助: http://www.emanueleferonato.com/2008/06/15/how-to-generate-friend-urls-with-htaccess-part-2/

I found this tutorial where the author explain step by step how to do exactly what you are trying to do. See if it helps: http://www.emanueleferonato.com/2008/06/15/how-to-generate-friendly-urls-with-htaccess-part-2/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文