PHP 框架Phalcon 問題記錄

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;
         }
去掉index.php:
if  ( $request_filename  !~ (js|css|images|robots/.txt|index/.php.*) ) {
             rewrite ^/(.*)$ /index.php/ $1  last;
             break ;
         }
相關文章
相關標籤/搜索