Apache/Mod Rewrite: Route everything to index.php?

后端 未结 1 1594
萌比男神i
萌比男神i 2021-01-22 12:21

I\'m writing a front-controller that will handle page requests, by parsing

$_SERVER[\'REQUEST_URI\'].

I would like to get all requests routed t

1条回答
  •  长发绾君心
    2021-01-22 12:47

    You could try something like this :

    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]
    

    0 讨论(0)
提交回复
热议问题