htaccess 和 MVC 路由
好吧,我开始编写一个迷你 MVC 基础,我可以在客户端网站上使用它,它也使用与 CakePHP 相同类型的路由器类。我目前的网址显示如下:
http://localhost/mvc/index.php?page=blog/viewall
它获取控制器并告诉它函数,就像 CakePHP index() 一样, view() 等。
现在,我不确定如何使用 .htaccess
http://localhost/mvc/blog/viewall
使 url 看起来像这样,我试图将其添加到 .htaccess 文件中:
<代码>RewriteRule ^(.*)$index.php?page=$1 [QSA]
Well i started coding a mini MVC base that I can just use on client websites, which also uses the same type of router class as CakePHP. I currently have the url display like this:
http://localhost/mvc/index.php?page=blog/viewall
Which gets the controller and tells it the function, just like CakePHP index(), view(), and so on.
Now, I'm not sure how I can make the url look like this with .htaccess
http://localhost/mvc/blog/viewall
I was trying to add this in the .htaccess file:
RewriteRule ^(.*)$ index.php?page=$1 [QSA]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的重定向规则如下:
Have your redirect rule like this: