<p>So semantically, I don’t love the URL format you’re coming up with.  I’d like to see something like <code>/gear/{category}/{entry}</code></p>

<p>This gives you a few benefits</p>

<ul>
<li>it’s semantically readable…  </li>
<li>it gives you natural breadcrumbs for the hierarchy of content</li>
<li>it’s likely going to be better from an SEO perspective</li>
</ul>

<p>Relevant feature request: <a href="https://github.com/craftcms/cms/issues/1189" rel="nofollow noreferrer">https://github.com/craftcms/cms/issues/1189</a></p>

CC BY-SA 3.0
2016-08-16T18:02:10.920Z
Changing the URL altogether could certainly make things easier. Your suggestion could odd with multiple category assignments and nesting.
Tim Kelty
CC BY-SA 3.0
2016-08-16T17:53:51.273Z
2017-03-15T22:24:18.813Z
2017-03-15T22:24:18.813Z
andrew.welch
<p>If you're only worried about URL collisions, it looks like there's only a few places where your routes overlap:</p>

<ul>
<li><code>gear/{slug}</code> could match a gear entry or a category.</li>
<li><code>reviews/{slug}</code> could match a category, gear entry, or review entry.</li>
</ul>

<p>One easy way around this is to just just make some of these routes more specific. For example:</p>

<ul>
<li><code>gear/{slug}</code> (gear entry)</li>
<li><code>gear/category/{slug}</code> (product type category)</li>
<li><code>reviews/category/{slug}</code> (product type category)</li>
<li><code>reviews/gear/{slug}</code> (gear entry)</li>
<li><code>reviews/{slug}</code> (review entry)</li>
</ul>

<p>Note: "category" above is the literal string, not the category's slug. But if "category" is too verbose, possibly just <code>gear/cat/{slug}</code> or <code>gear/c/{slug}</code>.</p>

<p>Or...</p>

<p>If you wanted to alter your URL formats minimally from your original scheme, another option would be to setup <code>gear</code>, <code>productTypes</code>, and <code>reviews</code> to all use the same route of <code>reviews/{slug}</code>. Craft <em>will</em> use a section's Entry URL Format when saving an entry to check for duplicate slugs. </p>

<ul>
<li><code>reviews/{slug}</code> (product type category)</li>
<li><code>reviews/{slug}</code> (gear entry)</li>
<li><code>reviews/{slug}</code> (review entry)</li>
</ul>

<p>Then just add a "category" segment for gear to make sure <code>gear</code> entries don't clash with <code>productTypes</code> categories:</p>

<ul>
<li><code>gear/{slug}</code> (gear entry)</li>
<li><code>gear/category/{slug}</code> (product type category)</li>
</ul>

CC BY-SA 3.0
2016-08-18T02:56:35.610Z
It does check the full URI for duplicates against any URL formats it knows about. Which is great, and the feature I'm trying to leverage.
Tim Kelty
CC BY-SA 3.0
2016-08-18T03:01:23.233Z
Yep, your "category" segment solution works, and is actually what I'm doing currently. It would be nice if there were a way to define both formats in Craft though, so that Craft itself knew about all your URLs. Feature request: http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/15678615-allow-multiple-url-formats-per-entry-type-entries
Tim Kelty
CC BY-SA 3.0
2016-08-18T08:25:22.833Z
You're right, @TimKelty! Craft does check other section Entry URL formats. Craft rulez. Thanks for bringing that to my attention. I'll update my answer.
Alex Roper
CC BY-SA 3.0
2016-08-18T11:51:01.173Z
Yeah, it's a really nice feature! Would be even better given something like my FR, which would allow Craft to know about ALL of your URLs.
Tim Kelty
CC BY-SA 3.0
2016-08-17T16:38:55.793Z
2016-08-18T08:43:56.530Z
2016-08-18T08:43:56.530Z
Alex Roper
<p>I suspect this boils down to a feature request, but I'll start here in case there are any other ideas.</p>

<p>Basically, I want to be able to define multiple URL formats for a single section or category group.</p>

<p>Here is the scenario:</p>

<ul>
<li>Section <code>gear</code> with URL format <code>gear/{slug}</code></li>
<li>Category group <code>productTypes</code> with URL format <code>gear/{slug}</code>, <code>{parent.uri}/{slug}</code></li>
<li>Section <code>reviews</code> with URL format <code>reviews/{slug}</code>.</li>
</ul>

<p>What I want to do but can't, is define a <em>second</em> URL format for <code>productTypes</code>, with the format <code>reviews/{slug}</code>, and <code>{parent.uri}/{slug}</code>.</p>

<p>Similarly, I want to define a 2nd format for <code>gear</code>, of <code>reviews/{slug}</code>.</p>

<p>So I'd end up with:</p>

<ul>
<li>gear/gear-entry/</li>
<li>gear/category/</li>
<li>reviews/category/</li>
<li>reviews/gear-entry/</li>
<li>reviews/review-entry/</li>
</ul>

<p>So I really need Craft to know about those additional formats to avoid crossover URLs.</p>

<p>Routing and assigning the <code>entry</code> and <code>category</code> variables is not a problem, I'm really just concerned with the slug/uri validation.</p>

<url><routes><slug>
Multiple URL Formats per element type (Entries, Categories)
# Multiple URL Formats per element type (Entries, Categories)

(Asked by: username_0 on 2016-08-15)

I suspect this boils down to a feature request, but I'll start here in case there are any other ideas.

Basically, I want to be able to define multiple URL formats for a single section or category group.

Here is the scenario:

* Section `gear` with URL format `gear/{slug}`
* Category group `productTypes` with URL format `gear/{slug}`, `{parent.uri}/{slug}`
* Section `reviews` with URL format `reviews/{slug}`.

What I want to do but can't, is define a *second* URL format for `productTypes`, with the format `reviews/{slug}`, and `{parent.uri}/{slug}`.

Similarly, I want to define a 2nd format for `gear`, of `reviews/{slug}`.

So I'd end up with:

* gear/gear-entry/
* gear/category/
* reviews/category/
* reviews/gear-entry/
* reviews/review-entry/

So I really need Craft to know about those additional formats to avoid crossover URLs.

Routing and assigning the `entry` and `category` variables is not a problem, I'm really just concerned with the slug/uri validation.

**Tags:** url, routes, slug

---

## 2 answers

### Answer by username_1 on 2016-08-16. Score: 3

So semantically, I don’t love the URL format you’re coming up with. I’d like to see something like `/gear/{category}/{entry}`

This gives you a few benefits

* it’s semantically readable…
* it gives you natural breadcrumbs for the hierarchy of content
* it’s likely going to be better from an SEO perspective

Relevant feature request: <https://github.com/craftcms/cms/issues/1189>

> **Comments:**
> **username_0**: Changing the URL altogether could certainly make things easier. Your suggestion could odd with multiple category assignments and nesting.  

---

### Answer by username_2 on 2016-08-17. Score: 1

If you're only worried about URL collisions, it looks like there's only a few places where your routes overlap:

* `gear/{slug}` could match a gear entry or a category.
* `reviews/{slug}` could match a category, gear entry, or review entry.

One easy way around this is to just just make some of these routes more specific. For example:

* `gear/{slug}` (gear entry)
* `gear/category/{slug}` (product type category)
* `reviews/category/{slug}` (product type category)
* `reviews/gear/{slug}` (gear entry)
* `reviews/{slug}` (review entry)

Note: "category" above is the literal string, not the category's slug. But if "category" is too verbose, possibly just `gear/cat/{slug}` or `gear/c/{slug}`.

Or...

If you wanted to alter your URL formats minimally from your original scheme, another option would be to setup `gear`, `productTypes`, and `reviews` to all use the same route of `reviews/{slug}`. Craft *will* use a section's Entry URL Format when saving an entry to check for duplicate slugs.

* `reviews/{slug}` (product type category)
* `reviews/{slug}` (gear entry)
* `reviews/{slug}` (review entry)

Then just add a "category" segment for gear to make sure `gear` entries don't clash with `productTypes` categories:

* `gear/{slug}` (gear entry)
* `gear/category/{slug}` (product type category)

> **Comments:**
> **username_0**: It does check the full URI for duplicates against any URL formats it knows about. Which is great, and the feature I'm trying to leverage.  
> **username_0**: Yep, your "category" segment solution works, and is actually what I'm doing currently. It would be nice if there were a way to define both formats in Craft though, so that Craft itself knew about all your URLs. Feature request: http://feedback.craftcms.com/forums/285221-feature-requests/suggestions/15678615-allow-multiple-url-formats-per-entry-type-entries  
> **username_2**: You're right, @TimKelty! Craft does check other section Entry URL formats. Craft rulez. Thanks for bringing that to my attention. I'll update my answer.  
> **username_0**: Yeah, it's a really nice feature! Would be even better given something like my FR, which would allow Craft to know about ALL of your URLs.  

---

