I’m building a blog that is going to live on: https://blog.domain.com. I’ve created an overview page inside the “home” folder and a template for its children. Everything is working well but the URL of the children is: https://blog.domain.com/home/article is it possible in some way to change them to https://blog.domain.com/article ?
Yes, see: Routing | Kirby CMS
Thank you! I have no idea what I’m doing with these routes so I’ve changed both the blog/ to home/
The homepage is working as it should but the children pages aren’t working anymore since the url changed to: http://localhost:8888/article instead of http://localhost:8888/domain/article
Here is the routing code from my config:
'routes' => [
[
'pattern' => '(:any)',
'action' => function($uid) {
$page = page($uid);
if(!$page) $page = page('home/' . $uid);
if(!$page) $page = site()->errorPage();
return site()->visit($page);
}
],
[
'pattern' => 'home/(:any)',
'action' => function($uid) {
go($uid);
}
]
]
Well, the routes will not work properly on a localhost setup like that unless you set the set the url
option in your config php, url | Kirby CMS.
Or use hosts urls like myfolder.test
locally… Laravel Valet gives you this option out of the box or if you have Mamp Pro or a similar application, you can also define hosts.
I’ll try end implement it when moving it to a hosted server… Thank you
It will work, that’s for sure