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
;
}