2017-03-25 1 views
0

こんにちは、ごめんなさい。ファルコンルーティング

私のサイト構造:

https://site.ru/category_1/.../category_N/post.html 

のroutes.php:

$router = new Phalcon\Mvc\Router(); 

$router->notFound(array(
    'controller' => 'index', 
    'action' => 'error404', 
)); 

$router->add(
    '/', array(
     'controller' => 'index', 
     'action' => 'index' 
    ) 
); 

$router->add(
    '/{uri:[a-zA-Z0-9\-\/\.]+}', array(
     'controller' => 'index', 
     'action' => 'index', 
    ) 
); 

$router->add(
    '/sitemapsyswrub7g5ox6mtz2tbplwiu6yduox6m.xml', array(
     'controller' => 'index', 
     'action' => 'sitemap' 
    ) 
); 

return $router; 

1)まずsite.ru/sitemapsyswrub7g5ox6mtz2tbplwiu6yduox6m.xml

2)次のチェックポストを確認してください。

コントローラ/アクションへのUri転送。

コントローラlook $ uriとload post。

3)次にメインページを確認します。 site.ru/index.php、site.ru/index.htmlとsite.ru/index.htmはhtaccessファイルのsite.ruにリダイレクトしています これは動作します。 しかし、私は問題があります。 URL場合:

site.ru/blabla_ 

その後、phalconショーのエラー:

BlablaController handler class cannot be loaded 

#0 [internal function]: Phalcon\Mvc\Dispatcher->_throwDispatchException('BlablaControlle...', 2) 
#1 [internal function]: Phalcon\Dispatcher->_dispatch() 
#2 [internal function]: Phalcon\Dispatcher->dispatch() 
#3 /home/srv/http/project/site.ru/public/index.php(23): Phalcon\Mvc\Application->handle() 
#4 {main} 

URLの場合:

site.ru/blabla_. 

は[OK]を、error404に動作します。

error404の正しいルーティングを行うためのヘルプ。

答えて

0

URL "sitemapsyswrub7g5ox6mtz2tbplwiu6yduox6m.xml" マッチ{URI:[-ZA-Z0-9 - /] +}

移動URI:[-ZA-Z0-9 - /] +}でエンドファイルルートルール

$router = new Phalcon\Mvc\Router(); 

$router->notFound(array(
    'controller' => 'index', 
    'action' => 'error404', 
)); 

$router->add(
    '/sitemapsyswrub7g5ox6mtz2tbplwiu6yduox6m.xml', array(
     'controller' => 'index', 
     'action' => 'sitemap' 
    ) 
); 

$router->add(
    '/{uri:[a-zA-Z0-9\-\/\.]+}', array(
     'controller' => 'index', 
     'action' => 'index', 
    ) 
); 

$router->add(
    '/', array(
     'controller' => 'index', 
     'action' => 'index' 
    ) 
); 

return $router;