-
I’ve added an url that bring players on a random game. This url should not be indexed. How add a noindex if this it’s a page? Probably it’s a JS.
-
Hello, I apologize for the inconvenience you’re facing. To add a noindex tag to a specific page on your website, you can use Rank Math’s Quick Actions feature. This will allow you to easily set the noindex robots meta for the page you want to exclude from Google’s index.
You can find detailed instructions on how to use the Quick Actions feature to set a page as noindex on our knowledge base article here: Quick Actions – NoIndex
If you have any further questions or need additional assistance, please feel free to ask. We’re here to help!
Sources:
Using Rank Math’s ‘Quick Actions’ Admin Menu Item
Google URL Inspection API Integration in Rank Math
Advanced Tab in Rank Math SEO’s Meta Boxspam…
Hello,
Thank you for contacting Rank Math support.
You can use this code to apply the noindex tag to the URL you specified:
/** * Allows filtering of the robots meta data. * * @param array $robots The meta robots directives. */ add_filter( 'rank_math/frontend/robots', function( $robots ) { // Get the current URL $current_url = home_url( $_SERVER['REQUEST_URI'] ); // The URL you want to exclude $exclude_url = 'https://youdomain.com/?randomgame=1'; // Compare the URLs and add noindex if they match if ( $current_url == $exclude_url ) { $robots['noindex'] = 'noindex'; } return $robots; });
To add the code to your website, use any of the methods listed here: https://rankmath.com/kb/wordpress-hooks-actions-filters/
We hope this helps you resolve the issue. If you have any other questions or concerns regarding Rank Math, please feel free to contact us again. We are always happy to help.
Thank you for choosing Rank Math!
I’ve added code as HTML
I’ve another urls that should not be indexed, but they appear on Webmaster tools.
On Yandex for example many urls are .php, .js, .css. On search Console i’ve instead ?s=, wp-admin, feed, wp-content/plugins, and my staging website.
What i should do?
Hello,
The code should be added as PHP code, you can also see this guide for other methods to add the code: https://rankmath.com/kb/wordpress-hooks-actions-filters/
If you want to use the code we shared to set multiple URLs to
noindex
, you’d have to modify the code a bit. Specifically, change:$exclude_url = 'https://youdomain.com/?randomgame=1';
to:
$exclude_url = array( 'https://youdomain.com/?randomgame=1', 'https://youdomain.com/another-page-here', 'https://youdomain.com/yet-another-page' );
The code would look like this:
add_filter( 'rank_math/frontend/robots', function( $robots ) { // Get the current URL $current_url = home_url( $_SERVER['REQUEST_URI'] ); // The URL you want to exclude $exclude_url = array( 'https://youdomain.com/?randomgame=1', 'https://youdomain.com/another-page-here', 'https://youdomain.com/yet-another-page' ); // Compare the URLs and add noindex if they match if ( $current_url == $exclude_url ) { $robots['noindex'] = 'noindex'; } return $robots; });
Regarding your other issue, if you want to prevent search engines from crawling a page, you can disallow it from your robots.txt. Here’s an example of how to disallow a page using a robots.txt rule:
User-agent: * Disallow: /wp-admin/
You can add this rule to Rank Math > General Settings > Edit Robots.tx.
We hope this helps you resolve the issue. If you have any other questions or concerns regarding Rank Math, please feel free to contact us again. We are always happy to help.
Thank you for choosing Rank Math!
Do you think it’s better to put the casual games url in the robots.txt?
I think the other paths will resolve themselves when your staff solves the problem I have on the permalinks due to your bug.
Hello,
While is more significant to add the noindex tag to the affected page, you can also disallow its crawling from the robots.txt. Simply include this disallow rule:
Disallow: /?randomgame=1
We hope this helps. Please let us know if you have further questions or concerns.
Thank you.
The casual games url is not indexed, but listed as a redirect on Search Console. Can I ignore this problem? If I put a rule in robots, then the report goes to blocked robots. So it would be the same thing.
Hello,
In this case, you can simply ignore the report for that URL – since the redirect is intentional.
Let us know if you need help with any thing else.
Ive robots.txt on page indexed. it’s normal?
Hello,
Nothing is wrong with your robots.txt getting indexed – even Rank Math’s robots.txt is indexed.
Cheers,
ty
Hello,
We are glad to hear that this issue has been resolved. Thank you for letting us know. This ticket will be closed now, but you can always open a new one if you have any other questions or concerns. We are here to help you with anything related to Rank Math.
We appreciate your patience and cooperation throughout this process.
Thank you for choosing Rank Math.
The ticket ‘Random games’ is closed to new replies.