# Remove "Category" from URL

**URL:** <https://forum.getkirby.com/t/remove-category-from-url/32008>\
**Category:** Questions\
**Tags:** v3\
**Created:** [July 9, 2024, 4:04pm UTC](https://forum.getkirby.com/t/remove-category-from-url/32008 "2024-07-09T16:04:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![christianwalter](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/christianwalter/32/10218_2.png) [@christianwalter](https://forum.getkirby.com/u/christianwalter)\
**Post date:** [July 9, 2024, 4:04pm UTC](https://forum.getkirby.com/t/remove-category-from-url/32008/1 "2024-07-09T16:04:39Z")

</div>

Hi together,

I need some hint, how I can solve this little problem. I have a page template which is only used as a category headline inside a mega menu. With that I can edit and manage the categories and all the pages “inside”. This actaully works fine. The category-pages themselves have no output.

But now I have long urls of the pages and I want to delete those categories/headlines from the url. I also have multiple levels of pages.

/level-1/level-2 → fine  
/level-1/level-2/level-3 → fine

/level-1/category-1-level-2/level3 → /level-1/level-3  
/level-1/category-2-level-2/level3 → /level-1/level-3  
/level-1/category-2-level-2/level3/level4 → /level-1/level-3/level-4

I hope you understand my issue. How would you do this? I’m searching for a solution for kirby 3.4 and which works generally for all kind of categorie and page titles – if possible.

I already found this topic, but It’s not really the same.

> [@Remove parent page name in subpage url](https://forum.getkirby.com/t/remove-parent-page-name-in-subpage-url/11013/8):
>
> Don’t know if. this is the best way to go about this, but try: c::set('routes', array( array( 'pattern' =\> 'blog/(:any)', 'action' =\> function($uid) { if($page = page('blog/'.$uid)) { go($page-\>parent()); } else { $categories = page('blog')-\>children()-\>pluck('uri', ','); $i = 0; while($i \< count($categories)) { if($page = page($categories[$i].'/'.$uid)) { return site()-\>visit($page); } $i++;…

THX

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [July 9, 2024, 4:48pm UTC](https://forum.getkirby.com/t/remove-category-from-url/32008/2 "2024-07-09T16:48:18Z")

</div>

This would be the go to docs: [Routes | Kirby CMS](https://getkirby.com/docs/guide/routing#removing-the-parent-page-slug-from-the-url)

With the difference that you want to remove the middle part, so you need to adapt that a bit.
