<p>I have entry which has route like this:</p>

<pre><code>category1/category2/.../entry-slug
</code></pre>

<p>There can be an unspecified number of categories - these are multilevel structure entries.</p>

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

<pre><code>category1/category2/.../entry-slug/edit
</code></pre>

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

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

<pre><code>(.*)/entry-slug/edit
</code></pre>

<p>But it didnt worked.</p>

CC BY-SA 4.0
2020-05-19T19:01:06.907Z
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
CC BY-SA 4.0
2020-05-19T19:02:36.513Z
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
<routes>
Route with unspecified number of segments
# Route with unspecified number of segments

(Asked by: username_0 on 2020-05-19)

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.

**Tags:** routes
> **Comments:**
> **username_1**: 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.  
> **username_1**: 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.  

---

## 0 answers

