htaccess的帮助MVC路由 [英] htaccess help with MVC routing

查看:106
本文介绍了htaccess的帮助MVC路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,我开始编码,我可以只在客户网站上也使用作为CakePHP的相同类型的路由器类的使用mini MVC基地。我现在有网址显示是这样

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页=博客/ viewall 它得到了控制,并告诉它的功能只是liek cakep PHP指数()视图()等。

http://localhost/mvc/index.php?page=blog/viewall which gets the controller and tells it the function just liek cakep php index() view() so on.

现在即时通讯不知道我怎么可以使URL看起来是这个样子的.htaccess 的http://本地主机/ MVC /博客/ viewall

now im not sure how i can make the url look like this with .htaccess http://localhost/mvc/blog/viewall

我试图添加此在的.htaccess 重写规则^(。*)$的index.php?网页= $ 1 [QSA]

i was trying to add this in the .htaccess RewriteRule ^(.*)$ index.php?page=$1 [QSA]

推荐答案

有这样的重定向规则:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/mvc/index.php/.*
RewriteRule ^/mvc/(.*) /mvc/index.php?page=$1 [QSA,L]

这篇关于htaccess的帮助MVC路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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