I have a page like domain.com/calendar/2001/8/22
, it can be visited by
domain.com/calendar/2001
domain.com/calendar/2001/8
domain.com/calendar/2001/8/22
It will show different content depending on URL.
I configured the urlManager
rules:
'calendar/<year:[\-\d]+>' => 'calendar/view',
'calendar/<year:[\-\d]+>/<month:[\d]+>' => 'calendar/view',
'calendar/<year:[\-\d]+>/<month:[\d]+>/<day:[\d]+>' => 'calendar/view',
It's OK. But when I visit domain.com/calendar/2008/8/
(with the trailing slash, my website users often visit with trailing slash), I get 404.
How to configure the urlManager
to handle rules with and without trailing slash?