我正在写一个前端控制器,通过parsing来处理页面请求
$_SERVER['REQUEST_URI'].
我想要所有请求路由到/index.php
一些例子如下:
example.com/page2?foo=bar example.com/page2/?foo=bar example.com/page/action/123/ example.com/page/action/123
什么是正则expression式规则,我必须在.htaccess中写入?
我需要一个额外的规则,以便example.com/images/目录将作为“正常”的目录?
你可以尝试这样的事情:
RewriteCond %{REQUEST_URI} !^/dir_under_rootdocument/index\.php RewriteCond %{REQUEST_URI} !\.(gif|jpg|png|js|css)$ RewriteRule (.*) dir_under_rootdocument/index.php/$1 [L,QSA]