You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if someone goes to anything other than '/' I have a wildcard route that grabs the name of that route, locates a twig file, and renders it based on name. So '/about' would locate about.twig and render it. It looks like this: [a:id]. I also have a /pages/[a:id] in case someone goes to '/pages/about', '/pages/contact', etc directly.
What I want to achieve is if someone goes to '/about' or '/contact', etc, then they'd be re-routed to '/pages/about', '/pages/contact', etc, but if they go to '/pages/about' directly then no re-route necessary.
But I how do I achieve that?
The text was updated successfully, but these errors were encountered:
If you mean redirected by "re-routed", then you'll have to implement that yourself.
Something like this:
$router->match('GET', '/pages', function() {
// /pages redirects to /pages/aboutheader('Location: /pages/about');
exit;
});
$router->match('GET', '/pages/[a:id]', function($id) {
// /pages/* echos the id from the urlecho$id;
});
I want my '/' route to remain as is.
But if someone goes to anything other than '/' I have a wildcard route that grabs the name of that route, locates a twig file, and renders it based on name. So '/about' would locate
about.twig
and render it. It looks like this:[a:id]
. I also have a/pages/[a:id]
in case someone goes to '/pages/about', '/pages/contact', etc directly.What I want to achieve is if someone goes to '/about' or '/contact', etc, then they'd be re-routed to '/pages/about', '/pages/contact', etc, but if they go to '/pages/about' directly then no re-route necessary.
But I how do I achieve that?
The text was updated successfully, but these errors were encountered: