I'm new to using Yii2 and have been using the urlManager, I have the following code, it works fine however I think that this should be shorter. I have a couple rules as follows :-
'rules' => [
'gifts/<subjectone:[\s\S]+>/<subjecttwo:[\s\S]+>' => 'gifts/index',
'gifts/<subjectone:[\s\S]+>/<subjecttwo:[\s\S]+>/' => 'gifts/index',
'gifts/<subjectone:[\s\S]+>' => 'gifts/index',
'gifts/<subjectone:[\s\S]+>/' => 'gifts/index',
];
As you can see I've added the 4 rules all to go to the same page to handle different situations.
I've had to add the same Url's twice, once with the /
and one without to stop 404's. Please advise of a better way to handle this.