I want to show the same page on all the subpaths on my web site
/events/
/events/firstOne
/events/secondOne/edit
/events/whatever/blahblahbla/helloworld
All that urls must load the same root page.
On that page (/events/
) I have a react
script that will handle everything from there with react router
, but, right now, if I try to load any thing different than /events/
, I just get a not found error.
How can I match a wildcard on that url?
EDIT:
I have tried to do it with add rewrite rule
, as recomended on this answer: https://wordpress.stackexchange.com/a/213322/164509, but doesn't work either
I have added this to my funtions.php
file:
// /public_html/wp-content/themes/kava/functions.php
<?php
function custom_rewrite_basic() {
add_rewrite_rule('^events/([a-z]+)/', 'show_event', 'top');
}
add_action('init', 'custom_rewrite_basic');
if ( ! class_exists( 'Kava_Theme_Setup' ) ) {
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since 1.0.0
*/
class Kava_Theme_Setup {
....
Then I refresh the rewrite rules database by clicking on save permalinks on the admin page.
But when I try to load /events/asdf
I still get a 404 not found error.
page
wich only contains the header, footer and the<script>
tag