https://abc.com/product/add-to-card=4
https://abc.com/product/?shop_row=4
These related URLs are getting indexed in Google, which is affecting my original page versions. I’m using Rank Math SEO plugin and have already created no-index settings through Rank Math (Titles & Meta > Misc Pages), but these related pages are still being indexed and crawled by Google.
To do no-index ‘add-to-cart’ related pages, I added code to my functions.php file to implement no-index for those URLs. After implementing this code, I can see it’s working properly. However, I still cannot find any option to apply no-index to pages with ‘shop_row=4’ parameters.
How can I prevent these ‘shop_row=4’ related pages from being indexed by Google?”
i submit code for add-to-card realated page do no-index in fuctions.php file { this code is work poperly )
do you want to see this code?
LooK this code:
add_filter( ‘rank_math/frontend/robots’, function( $robots ) {
$url = home_url( $_SERVER[‘REQUEST_URI’] );
if( (strpos($url,’?add-to-cart=’) !== false) ) {
$robots[‘index’] = ‘noindex’;
$robots[‘follow’] = ‘nofollow’;
}
return $robots;
});
Now i want to no-index for “https://abc.com/product/?shop_row=4” related page