1

I have entry which has route like this:

category1/category2/.../entry-slug

There can be an unspecified number of categories - these are multilevel structure entries.

I want to add an entry edit page on the frontend. This page would have URL like this:

category1/category2/.../entry-slug/edit

How do I create route for this? In routes.php file, I need to put specific route segments into an array - how do I set "unspecified number of category segments"?

I fount on some Yii related forum information that it can be done using (.*) wildards, so i tried this:

(.*)/entry-slug/edit

But it didnt worked.

  • This comment evades the question but the architecture feels problematic to me. If categories change, and thus URIs will change, and you then have content that doesn't have its special Universal Resource Identifier without ongoing change management. – Ben Parizek May 19 '20 at 19:01
  • 3
    More to the question, I would ask, is the number of categories truly infinite? If not, maybe you just need an upper limit and to configure several routes that handle each case using wildcards (.*) as segments in decreasing specificity to represent the different patterns you would need to handle. – Ben Parizek May 19 '20 at 19:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.