How to index all urls with any query parameters

#342866
  • Resolved muhammad ali
    Rank Math free

    Hi,

    I have an issue with rank math.
    I had selected the option to no index any query parameter, but still, it shows index meta tag on pages with a query parameters.

    and google index that page although I had blocked them using robot.txt file

    for example you can apply anu filter on this page

    and it’s an e-commerce site, so it will add a query string of filter. now there is an index meta tag on this page that allows Google to index it.

    index meta tag on ac category page of shoppingjin.pk

    as for settings, all of these fields are on
    settings of rank math
    please help

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    Could you please try this code to set those filtered product category pages to noindex?

    add_filter( 'rank_math/frontend/robots', function( $robots ) {
    if ( is_product_category() || isset($_GET['filtering'])) {
    	$robots['index'] = 'noindex';
    	return $robots;
    }
    return $robots;
    });

    The filter should be added to your active theme’s functions.php file. Here’s another way to apply the filter using the rankmath.php file:
    https://rankmath.com/kb/filters-hooks-api-developer/#adding-filters-and-hooks-in-rank-math-php

    Once done, clear your website’s cache and check again the filtered page.

    I hope that helps.

    Thank you.

    Worked like a charm, amazing support like always.

    moving to rank math from Yoast was one of my best decision <3

    Hello,

    We are super happy that we have addressed your concern. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind us asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘How to index all urls with any query parameters’ is closed to new replies.