How to redirect old urls with capturing only the variable end and add multiple possible targets before
OLD URLS
domain.com/product/product-link-xyz ...
TO
domain.com/products/brand1/product-link-xyz-1
domain.com/products/brand1/product-link-xyz-2
domain.com/products/brand1/product-link-xyz-3
My not working solution so far
location ~ ^/product/(.*) {
rewrite ^(/product/.*)\..*$ $1/products/brand1/$2 break;
rewrite ^(/product/.*)\..*$ $1/products/brand2/$2 break;
}
returns in every /product/product-xyz ends in 404 not found.
thanks in advance for your kind help