Routing to entire site link

Hello I want to make my url cleaner. Here what i want to achieve.
Old URL: domain.com/blog/post-1
new URL: domain.com/post-1

Yes it’s actually work with routing tutorial here

but the problem is the old url still coming on all post url.

here is example on domain.com/blog/

all article still use old link even if i Click the link it’s redirect to new url:

domain.com/blog/post-1
domain.com/blog/post-2
domain.com/blog/post-3

is there any chance to rewrite all url within site into new one? thank You

Check out this post: Direct link to routed url

woooww what a fast support. which file that I should include that code?

<?php

class ArticlePage extends Page {
function url() {
return site()->url() . '/' . $this->uid();
}
}
1 Like

It’s a page model. You can read more about them and where to put them in the docs.