No index special pages

#37000
  • Resolved Yerai
    Rank Math free

    Hello RankMath team. Your plugin is awesome! Right now I’m facing a problem with some thin content pages getting indexed. Is there a way to noindex /?p=* pages? I have tried no indexing search results, pagination pages, archive pages and password protected pages without success. Also I have disallowed ?p= pages in robots.txt.
    Thank you in advance! 🙂

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

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    I can suggest that you test the following code that will set pages that contain ?p= to noindex:(code should go in your theme’s functions.php file)

    /**
     * Allows filtering of the robots meta data.
     *
     * @param array $robots The meta robots directives.
     */
    add_filter( 'rank_math/frontend/robots', function( $robots ) {
            if (strpos($_SERVER['REQUEST_URI'], "?p=") !== false){
                $robots['index'] = "noindex";
                $robots['follow'] = "nofollow";
                return $robots;
            }
    	return $robots;
    });

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Yerai
    Rank Math free

    Hello Michael,

    First things first, props to you for your hard work helping RankMath community in its SEO struggles. I’ve always found your answers very insightful and now it is not an exception! The function did wonders! 🙂

    This is my first time asking for help here and I’m delighted to have a fast and reliable response. Thank you very much for your help! Keep rocking!

    Hello,

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

    If you don’t mind me 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 do 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 ‘No index special pages’ is closed to new replies.