Hello,
Thank you for contacting Rank Math support, and sorry for any inconvenience that might have been caused due to that.
Typically, Rank Math automatically sets 404 pages to noindex
. Can you please confirm if this 404 page is a templated page from your theme?
You may share your website URL with us here so we can further check.
Also, you may follow this filter to forcibly mark the robots meta as noindex
:
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"];
if($url == 'TARGET_URL') {
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});
Looking forward to helping you on this one.
Hello, thank you for your answer.
Where should I put that code filter?
My website is: http://www.stefanocassaro.com
I thank you in advance if you can help me to fix this problem,
Kind regards
Hello,
You can add the filter to your theme’s functions.php file.
Here is a guide you can follow to add the filter:
https://rankmath.com/kb/wordpress-hooks-actions-filters/#functions-php-file
However, I checked a 404 page on your website and it is already set to noindex.
Hope this helps.
Don’t hesitate to get in touch if you have any other questions.
Hello,
We are glad we could address your concern. 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.