i have many urls showing with blank item id of couple of components. Sample been 'news' and 'prices'



Have tested using

RewriteCond %{QUERY_STRING} ^(.*)&Itemid=(&|$)(.*)$
RewriteRule ^(.*)$ /$1?%1&Itemid=10&%3 [L,R=301]
But above is redirecting both news and offers to itemid 10 only

The correct itemid of news is 9 and of offers is 10. Infact there are other components too like com_blog, com_loan .. all have different and unique itemid

how to create the condition in such a way that com_news , com_prices is also taken as logic condition by htaccess so that the redirection rule can then be set for respective itemid

I can then customize accordingly the rule by specifying itemid of that component in rewriterule