Hello! Please tell me how to redirect c links:

http://site.ru/product.php?article=13223112 

on:

 http://site.ru/product.php?article=13223112&name=tovarname 

I added one more parameter when clicking on the link so that the keyword was added to the address, but now I’ve got duplicates

Will such a template fit correctly or need to be conjured?

 RewriteRule ^news/happy.* /news.html [R=301,L] 

    1 answer 1

     RewriteEngine On RewriteCond %{QUERY_STRING} ^article=(\w+)$ [NC] RewriteRule ^product\.php$ http://site.ru/product.php?article=%1&name=tovarname [R=301,L] 

    True, if tovarname is a unique string for each page, then the entire redirection will have to be done not in .htaccess, but in the engine on which the site is spinning.

    • Yes, the product Naming unique redirection with CNC works only for the link with two get parameters RewriteCond% {ENV: REDIRECT_STATUS} ^ $ RewriteCond% {QUERY_STRING} ^ article = ([^ &] *) & name = ([^ &] *) RewriteRule ^ product \ .php $ /%1/%2.html? [R = 301, L] RewriteRule ^ ([^ /] *) / ([^ /] *) \. Html $ /product.php?article=$1&name=$2 [L] but the infection remains in the index with one link Get the parameter - Bul Zapatronen
    • @BulZapatronen, if you have a bunch of rules in .htaccess there, then drop it all. Write a router with all the rules in the programming language in which your site works. And in .htaccess, just make a single entry point for this variant: ru.stackoverflow.com/a/551401/186083 - Visman