问题
I've been searching and have yet to find an article to help me. I'm very unfamiliar when it comes to the rewrite engine of htaccess files, and am currently developing a php mvc framework.
Basically, from the root of the webserver, I need all page requests with their controllers / actions in the url to redirect to App/index.php
So, for example site.com/Login/ would direct to the index.php, and the uri would obviously be parsed out with php to enact the login controller with passed post data.
回答1:
I think the 'usual' way is to forward all requests for non-existent files and directories to your controller:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^ App/index.php [L]
来源:https://stackoverflow.com/questions/7693788/htaccess-url-routing-for-php-mvc