A
A
arab7892015-08-14 11:59:34
Yii
arab789, 2015-08-14 11:59:34

Why does the rule in urlManager not work?

I make a sitemap, created a rule: 'sitemap.xml'=> array('sitemap/index', 'urlSuffix' => ''), if I go to site.com/sitemap.xml, then nothing in response, I get only a string like: "This XML file does not appear to have any style information associated with it. The document tree is shown below." It doesn't reach my controller and the view, what's wrong?
Here is the urlManager code:

'urlManager'=>array(
                        'class'=>'DLanguageUrlManager',
      'urlFormat' => 'path',
                        'showScriptName'=>false,
                        'urlSuffix' => '',
                            'rules'=>array(
                                
                                'sitemap.xml'=> array('sitemap/index', 'urlSuffix' => ''),
                                
                                'page/<id:\d+>/<alias:.*>/<platform:.*>' => 'page/index/',
                                'page/<id:\d+>/<alias:.*>' => 'page/index/',
                                'page/<id:\d+>' => 'page/index/',
                                'page' => 'page/index/',
                                
                                'review/<id:\d+>/<alias:.*>' => 'review/index/',
                                'review/<id:\d+>' => 'review/index/',
                                '<controller:\w+>/<id:\d+>' => '<controller>/index',
                                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',
                                '<controller:\w+>/<action:\w+>' => '<controller>/<action>',
                                
                                
      ),
    ),

If you access the site.com/sitemap/index controller, then everything works.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Khomenko, 2015-08-14
@arab789

Is there a sitemap.xml file in the web folder by any chance? :)

A
Alexander Litvinenko, 2015-08-14
@edli007

just try
'sitemap.xml'=> 'sitemap/index'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question