Wednesday, October 26, 2022
HomeWordPress Developmenturl rewriting - Add rewrite endpoint and .htaccess

url rewriting – Add rewrite endpoint and .htaccess


I am attempting to make a redirection with .htaccess and rewrite endpoint (add_rewrite_endpoint()) and it is working however on the time of redirection it provides a /1/ to the route and I do not perceive the place it comes from. My htaccess rule:

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

The endpoint rewrite:

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

The url i take advantage of:

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

And the ultimate url is:

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

Why this /1/?

Excuse my poor english if unsuitable and thanks upfront.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments