Saturday, November 26, 2022
HomeWordPress DevelopmentRewrite rule to index.php in theme subfolder

Rewrite rule to index.php in theme subfolder


I am attempting to create a rewrite to an index.php in a subfolder of my theme. However with this code I solely find yourself on the entrance web page:

perform coupon_query_vars( $query_vars ){
$query_vars[] = 'gutschein';
return $query_vars;} 
add_filter('query_vars', 'coupon_query_vars');


perform add_coupon_rewrite_rules($guidelines) {
$theme_name = subsequent(explode('/themes/', get_stylesheet_directory()));

$newrules = array(
    '^gutschein-pdf/([^/]*)/?$' => 'wp-content/themes/'. $theme_name . '/pdf/?gutschein=$matches[1]',
);
$guidelines = $newrules + $guidelines;
return $guidelines;}
add_filter('rewrite_rules_array', 'add_coupon_rewrite_rules');

The great url seems like:
https://area.com/gutschein-pdf/coupon_hb0j9f/

And it ought to redirect to:
https://area.com/wp-content/themes/themename/pdf/?gutschein=coupon_hb0j9f

What do I’ve to vary on the this rule?

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments