url rewriting – Add rewrite endpoint and .htaccess

Question

I’m trying to make a redirection with .htaccess and rewrite endpoint (add_rewrite_endpoint()) and it’s working but at the time of redirection it adds a /1/ to the route and I don’t understand where it comes from. My htaccess rule:

Redirect 301 /wp-content/plugins/custom-plugin/public/partials/informe.php /informe-calculadora/$1

The endpoint rewrite:

function add_virtual_page_template() {
    global $wp_rewrite;
    add_rewrite_endpoint('informe-calculadora', EP_ROOT );
    $wp_rewrite->flush_rules();
}
add_action( 'init', 'add_virtual_page_template' );

The url i use:

https://xxxx.com/wp-content/plugins/custom-plugin/public/partials/informe.php?email=asxxxxxsd@xxx.com&id=610

And the final url is:

https://xxxx.com/informe-calculadora/1/?email=asxxxxxsd@xxx.com&id=610

Why this /1/?

Excuse my poor english if wrong and thank you in advance.

0
Javi Ps 1 month 2022-10-26T08:02:04-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse