重写 url:同时提供查询字符串和块 url
我的 MVC 学习之旅仍在继续,尽管很艰难,但我正在学习很多其他方式无法学到的东西。现在我遇到了路由问题。目前我正在使用 $_SERVER["REQUEST_URI"] 并获取控制器和方法以及任何参数。当网址格式为 http://mysite.com/forum/thread/12/1123 没有问题,但我还需要捕获类似 http://mysite.com/index.php?forum=12&&thread=1123。 我已阅读下面线程中的链接,但无法了解 QSA,但我最好还是问一下。
谢谢
my journey of learning MVC continues and as hard as it is, I'm learning a lot of things I could never learn otherwise. Now I have faced the problem in routing. Currently I'm taking the $_SERVER["REQUEST_URI"] and get the controller and method and any args. When url is in format http://mysite.com/forum/thread/12/1123 there is no problem but I need to catch also requests like http://mysite.com/index.php?forum=12&&thread=1123.
I have read links in threads below but cannot get my head on QSA and I though I would better ask.
Thanks
mod_rewrite: Check for Custom query string in URL?
Rewrite url with query string in htaccess
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终写了一些像以前一样的东西:
我使用 htaccess 重定向
I ended up writing something like before:
I redirect using htaccess