开发者

htaccess and MVC routing

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 u开发者_运维技巧rl 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]


Have your redirect rule like this:

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜