Rewrite rules with WordPress function without 301 redirect
-
Trying to setup a redirect from URL structure:
brand/abc/[category]/
to
product-category/[category]/?filtering=1&filter_product_brand=69by using this function
add_filter( 'rewrite_rules_array', function( $rules ) { $new_rules = array( 'brand/abc/([^/]+?)/?$' => 'product-category/$matches[1]?filtering=1&filter_product_brand=69', 'brand/def/([^/]+?)/?$' => 'product-category/$matches[1]?filtering=1&filter_product_brand=68', 'brand/ghi/([^/]+?)/?$' => 'product-category/$matches[1]?filtering=1&filter_product_brand=71', ); return $new_rules + $rules; } ,20,1);
This does a redirect to the target URL, but I would like to show the original URL () and show content of the target URL. So no 301 redirect. How can I do this? Is it better to do it in a function or in de .htaccess file?
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Rewrite rules with WordPress function without 301 redirect’ is closed to new replies.