I can’t seem to get my routes working, even a simple one like below returns a 404. How can I debug this?
edit config.localhost.php
c::set('routes', array(
array(
'pattern' => '(:any)',
'action' => function() {
die('testing');
},
)
));
Does the site work without routes?
Sorry that I should’ve made that clearer, all pages from template work fine. It’s just custom routes like the above.
Is local.config.php
really the name of your config file? If so, Kirby will not read it and you will end up on the error page.
See naming of config files in the docs: https://getkirby.com/docs/developer-guide/configuration/options/#multi-environment-setup
no, it’s config.localhost.php. Everything on it works fine excluding the custom route
Hm, there’s nothing wrong with that route. Have you tested this in a fresh StarterKit?
I tested it with starterkit and it worked fine. I believe I’ve managed to find the problem now.
I’m using SCK: Stripe Checkout for Kirby, I to nclude the line include 'sck.config.php';
in my config. If I comment this out the route works fine. How can I get the route and SCK to work together?
config.localhost.php
<?php
c::set('debug', true);
c::set('cache', false);
// The code below are required for the kirby-webpack dev server to work
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR'] === 'webpack') {
c::set('url', $_SERVER['HTTP_X_FORWARDED_PROTO'] . '://' . $_SERVER['HTTP_X_FORWARDED_HOST']);
}
c::set('home', 'projects');
c::set('cache.ignore', array('sitemap'));
c::set('routes', array(
array(
'pattern' => '(:any)',
'action' => function() {
die('testing');
},
)
));
// this is causing the route not to execute
include 'sck.config.php';