PHP Variable to WordPress shop page

I have a link:

http://www.ignitionmarketing.co.za/products_promoDC.php?Product_Category=Corporate+Gifts

I would like it to be:

Read More
http://www.ignitionmarketing.co.za/product-category/corporate-gifts/

Also I have tried the normal way of:

Redirect 301 /products_promoDC.php?Product_Category=Corporate+Gifts http://www.ignitionmarketing.co.za/product-category/corporate-gifts/

But it still stays on a 404 page.

Could someone please help me?

Added Note:

I have a couple of other links that need to be redirected like:

/products_promoDC.php?Product_Category=Corporate+Clothing

/products_promoDC.php?Product_Category=Corporate+Clothing&Product_Subcategory=Shirts

The new WordPress shop does have the same categories as well.

Related posts

Leave a Reply

1 comment

  1. Just a better explanation to the solution. Maybe you come across a similar issue in the future.

    I redirected my “products_promoDC.php” to /product-category/ so the Variable/Parameter is then only loaded behind (/product-category/Corporate+Clothing/) this still gave me a 404 error because of the plus (+) within the URL. I simply then wrote a RewriteRule to convert the pluses (+) to dashes!

    Much easier than to do a RewriteMatch which could cause problems with the Subcategories.

    RewriteRule "^([^+]*)++([^+]*+.*)$" /$1-$2 [N]
    RewriteRule "^([^+]*)++([^+]*)$" /$1-$2 [L,R=301]
    
    RewriteCond %{QUERY_STRING} Product_Category=([^&]+) [NC]
    RewriteCond %{QUERY_STRING} Product_Subcategory=([^&]+) [NC]
    RewriteRule products_promoDC.php product-category/%1/? [L,R=301]
    

    I added a second line for my subcategories to load as well!

    Working perfectly:
    http://www.ignitionmarketing.co.za/products_promoDC.php?Product_Category=Corporate+Gifts