<p>Have you tried processing the entire slug directly in your template, without setting a complex route? Check for the presence of the string "-and-", split the slug accordingly, build a Category query. </p>

CC BY-SA 4.0
2019-05-31T07:22:41.617Z
2019-05-31T07:22:41.617Z
gioppe
<p>Can't figure out how to create a dynamic route for the categories in this format:</p>

<pre><code>site.com/news/category-1-and-category-2-and-category-3 
</code></pre>

<p>That would bring the results from these slug categories.</p>

<p>Trying to build a complex query and I'm sure there is bound to be a better way of doing it that.</p>

<pre><code>'news/&lt;categories:.*&gt;/&lt;categorySlugs:{slug}(\-and\-{slug})+&gt;' =&gt; ['template' =&gt; 'news/index']
</code></pre>

<search><routes><slug>
How to make a multiple route?
# How to make a multiple route?

(Asked by: username_0 on 2019-05-27)

Can't figure out how to create a dynamic route for the categories in this format:
site.com/news/category-1-and-category-2-and-category-3 

That would bring the results from these slug categories.
Trying to build a complex query and I'm sure there is bound to be a better way of doing it that.
'news//' => ['template' => 'news/index']

**Tags:** search, routes, slug

---

## 1 answers

### Answer by username_1 on 2019-05-31. Score: 1

Have you tried processing the entire slug directly in your template, without setting a complex route? Check for the presence of the string "-and-", split the slug accordingly, build a Category query.


---

