luyadev / luya

LUYA is a scalable web framework and content management system with the goal to please developers, clients and users alike.
https://luya.io
MIT License
812 stars 207 forks source link

urlNormalizer don't work #2056

Closed Taroxx closed 3 years ago

Taroxx commented 4 years ago

Hi,

I want to use yii2 UrlNormalizer, but there is no effect.

'components' => [     
        'urlManager' => [
            'class' => 'luya\web\UrlManager',
            'enablePrettyUrl' => true,
            'enableStrictParsing' => true,
            'showScriptName' => false,
            'suffix' => '/',
            'normalizer' => [
                'class' => 'yii\web\UrlNormalizer',
                'collapseSlashes' => true,
                'normalizeTrailingSlash' => true,
                'action' => UrlNormalizer::ACTION_REDIRECT_TEMPORARY,
            ],
        ]
]

I have tried every possible config settings, but it never works. However, if changing the class of normalizer to some random string, will throw an error. But any manipulations with other options is no effect. I tried to pass normalizer to urlRule - is no effect.

nadar commented 4 years ago

hey @Taroxx

I never tested the UrlNormalizer, the CMS should already make correct urls without trailing slashes. In order to generate the LUYA CMS page paths we had to extend the UrlManager a little bit, therefore maybe thats why the normalizer won't work.

Could you please tell me your use case? What would you like to change?

nadar commented 4 years ago

What modules are you using? With CMS and Admin? only the core? Here for example you can see the CMS route which catches all requests in order to pass them to the CMS, maybe thats we. But i would have to take closer look at url normalizer, but until now i could not see the benefits of the normalizer.

https://github.com/luyadev/luya-module-cms/blob/master/src/frontend/components/CatchAllUrlRule.php

nadar commented 3 years ago

I am going to close this issue because:

If you think this is still important or there are more/new informations. Please reopen the issue and let us know.

If this is a problem or a feature you like to discuss, join our forum: forum.luya.io. We try to keep our issue tracker as clean as possible in order to focus on active issues.