There is a site, customized CNC links, but the site is indexed before the CNC was made. therefore, there were doubles with old URLs. The task is to make redirect 301. How I tried to do it / Here is the code that stands, which I modify myself

RewriteRule cat([0-9]+)-.* index.php?categoryID=$1 [L,QSA] RewriteRule prod([0-9]+)-(.*)$ index.php?productID=$1&$2 [L,QSA] RewriteRule orderA$ index.php?orderA=1 [L,QSA] RewriteRule orderAQ$ index.php?orderAQ=1 [L,QSA] RewriteRule admin$ admin.php [L,QSA] ErrorDocument 404 /index.php?page_not_found=yes 

My logic, I create a rule, if the robot follows the link of a type that does not cnc do rewriteRul R = 301

 RewriteCond %{QUERY_STRING} index.php?categoryID=([0-9]+) [NC] RewriteRule ^.*$ cat%1? [R=301,L] 

Similarly for productID. This is one of the options I tried. I read a lot of posts on this topic, the same terminology on the off-site But in the end it did not work out yet. Dear experts, please help or direct me in the right direction. I will be grateful for any information that will help me to be torn. Thank you for your time.

    0