我是一个新的程序员,目前正在学习
PHP的MVC.我从头开始建立一个框架/ MVC系统……现在我面临的问题的.htaccess.
example.com = localhost // unable to post question for localhost link
我的应用程序的URL是这样的…
http://example.com/mvc/index.PHP?go=test //test is a controller's name
通过从.htaccess中的帮助下,我清理的URL ….
http://example.com/mvc/test
如果控制器不存在,它显示了一个错误视图,其中包含一些错误消息.
http://example.com/mvc/doesnotexists
但是,如果我把“/”(正斜杠)的网址…
http://example.com/mvc/test/
我也包含在URL控制器方法…
http://example.com/mvc/test/viewresult
如果在控制器显示错误消息,没有发现匹配的方法,它显示但同样的问题…没有CSS也不js的.
我已经完全加载CSS和JS如果我经历完整的URL
http://example.com/mvc/index.PHP?go=doesnotexists/
等等
我尝试了好几种的.htaccess规则,但无法得到它的工作.请帮忙在此先感谢.我currrent的.htaccess代码…
<IfModule mod_rewrite.c> # Turn on RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l #RewriteCond %{REQUEST_URI} !^/assets/ #RewriteCond $1 !^(favicon\.ico|favicon\.png|media|robots\.txt|crossdomain\.xml|.*\.css|.*\js) RewriteRule ^(.+)$index.PHP?go=$1 [QSA,L] # Generic 404 for anyplace on the site # ... </IfModule>