T
T
Tarakkolya2014-06-04 13:50:46
Zend Framework
Tarakkolya, 2014-06-04 13:50:46

Problem with ZF2 route?

'places' => array(
               'type' => 'Segment',
               'options' => array(
                   'route'    => '/places/[:action/]]',
                   'constraints' => array(
                       'controller' => 'Application\Controller\Places',
                       'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                   ),                    
                   'defaults' => array(
                       '__NAMESPACE__' => 'Application\Controller',
                       'controller'    => 'Places',
                       'action'        => 'index',
                   ),
               ),
           ),

registered the route in this way. If you remove /places/ , then the desired action of the desired controller works on the main page, if not removed, it gives a 404 error on sitename/places/ . What could be the problem?
a view and this entry in module.config are available.
'controllers' => array(
       'invokables' => array(
           'Application\Controller\Index' => 'Application\Controller\IndexController',
           'Application\Controller\Places' => 'Application\Controller\PlacesController'
       ),
   ),

the path of the form: sitename/index/index/ also does not work, although the path is specified in the config
'application' => array(
                'type'    => 'Segment',
                'options' => array(
                    'route'    => '/:controller/[:action/]',
                    'constraints' => array(
                        'controller' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'action'     => '[a-zA-Z][a-zA-Z0-9_-]*',
                    ),
                    'defaults' => array(
                        '__NAMESPACE__' => 'Application\Controller',
                        'controller'    => 'Index',
                        'action'        => 'index',
                    ),
                ),
            ),

I tried other routes too, except for sitename/, they don't work.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
Tarakkolya, 2014-06-04
@Tarakkolya

found, the problem was in the host settings, any routes other than sitename/ translated to 404. I'm sorry for the off-topic question =)

I
Ilya Lesnykh, 2014-06-04
@Aliance

'route' => '/places/[:action/]]',

extra ] ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question