wrong route when URL contains trailing slash

I have to support one old project which uses Yii1. I get very strange behavior. Pretty URL is configured.

When URL doen’t have a trailing slash (e.g. /about or /blog/post/5) everything goes OK (the route is correct and the correct page is displayed). But the same URLs with trailing slash (/about/ or /blog/post/5/) make a wrong route. Disregarding of url I always get the route ‘main/index’ and index page is displayed (not redirected to, but displayed at all URLs with trailing slash).

Any ideas?

Which Yii version?

What’s in the urlManager config section?

Version is 1.1.19.




'urlManager' => [

	'cacheID'          => null,

	'class'            => 'UrlManager',

	'urlFormat'        => 'path',

	'caseSensitive'    => true,

	'matchValue'       => true,

	'showScriptName'   => false,

	'urlSuffix'        => '/',

	'useStrictParsing' => true

	]



When I remove urlSuffix it doesn’t change the behavior.

Also useStrictParsing doesn’t work. I can write any “bla-bla-bla” as URL and it also shows me the index page.

Obviously you have a customized UrlManager (instead of default CUrlManager).

Perhaps something related to that one.

(my old pre-2012 simple lab projects need the url rules. I tried but didn’t get any problem with a trailing ‘/’.)

Thank you for replies!

It seems to be a problem with environment. The same code works well on one VPS, and produces the described problems on another. This is even more strange. PHP version is the same, nginx config the same.

Maybe you are aware of any incompatibilities or denendencies?