Home Redirect Wordpress
Reply: 0

Redirect Wordpress

user1034 Published in May 21, 2018, 12:52 pm

I have a WordPress site with WooCommerce installed and Avada theme. I am trying to do a rewrite rule via functions.php file.

I want that what arrives on http://example.com/product/SKU01 has to be redirected on http://example.com/custom-file.php?prod_sku=SKU01

add_action('init', 'dcc_rewrite_tags');
function dcc_rewrite_tags() {
    add_rewrite_tag('%propref%', '([^&]+)');

add_action('init', 'dcc_rewrite_rules');
function dcc_rewrite_rules() {

Within a plugin (Rewrite Rule Inspector) I can see that all is working but, when I try to open the URL on the frontend, it is not working.

This is not working at all. My WooCommerce doesn't use any "product" string in its URLs, but it is not working at all. I also tried with .htaccess but I get the same behavior. Every time I call /product/sku01 I am redirected to 404 page.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.394504 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO