1.问题:用官方的例子,首页能够正常打开,但好比说 /signup,contact/index 这样的链接都是出现404 file not find,这样的错误。以上问题在Apache web server是好的。php
解决方法:URL重写致使。直接访问 localhost/index.php?_url=/控制器名/方法名. 如: /index.php?_url=/signupcss
Nginx rewrite:web
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$
/index
.php?_url=/$1;
}
if
(
$request_filename
!~ (js|css|images|robots/.txt|index/.php.*) ) {
rewrite ^/(.*)$ /index.php/
$1
last;
break
;
}