Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Routing problem - see index everyway

Hi guys!

I created routing at:

    $di->set('router', function () {

        //return require_once 'app/config/routes.php';
        $router = new Phalcon\Mvc\Router(false);

    // Игнорим слеш в конце
    $router->removeExtraSlashes(true);

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

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

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

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



    return $router;

    });

what i doing wrong? every way i see index controller and index action :(



64.2k

multi / signle module app ?

edited Oct '15

single



64.2k

can you try by removing the false here

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

:( no, it solution not helped

may be i have bad dirs structure in view ?



64.2k
Accepted
answer
edited Oct '15

.htaccess stuff is all set up ?

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

i use nginx, Thanks for the tip!!

location /{
    autoindex off;
    index index.php index.html;
    if (!-e $request_filename) {
        #rewrite ^(.*)$ /index.php;
        rewrite ^(.*)$ /index.php?_url=$1;
    }
    }

I forgot to add _url=$1 )

thanks!