2016-03-12 37 views
0

我開始學習Phalcon Micro Application,並使用phalcon開發工具生成了該項目。 我面臨路線問題。微應用Phalcon「/」路由重定向到Not not found

以下是對的.htaccess和我的路由代碼,但每當我去以外的任何其他根「/」,它的工作原理,但對於「/」路線它去找不到路線。

默認的.htaccess

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteRule ^$ public/ [L] 
RewriteRule (.*) public/$1 [L] 
</IfModule> 

公共文件夾的.htaccess

AddDefaultCharset UTF-8 

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^(.*)$ index.php?_url=/$1 [QSA,L] 
</IfModule> 

我的公共/ index.php的路線是:

$app->get('/', function() { 
    echo "home"; 
}); 

$app->notFound(function(){ 
    echo "not Found"; 
}); 

我的項目是在漂泊不定的VM與以下url

http://192.168.50.4/api/ 

能否請你幫我

真的很感激

感謝,

+0

什麼ü時得到的http:// 19 2.168.50.4? –

+0

嗨扎勒,我得到流浪框的默認頁面。我的項目在api文件夾中。 – user280960

回答

1

或者:

$di->set('url', function() { $url = new Url(); $url->setBaseUri('/api/'); return $url; });