How to noindex media files (pdf file in specific)

#252549
  • Resolved Nicola Melli
    Rank Math free

    Hello Rank Math staff,

    I have a lead magnet pdf on my wordpress website that I don’t want to be indexed in Google. How can I do?

    For now, I have checked the option “exclude from sitemap”, from the wordpress media file interface. Is there any way, maybe through rank math, to set a noindex on this media file?

    Thank in advance!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Tammy
    Rank Math business

    Hello,

    Thank you for contacting Rank Math today.

    You may simply add a Disallow declaration to your robots.txt if you don’t want Google to crawl any of your pdf files: Disallow: *.pdf

    Please refer to this tutorial guide for more details on editing the robots.txt file with Rank Math: https://rankmath.com/kb/how-to-edit-robots-txt-with-rank-math/

    I hope this information is helpful, and please do not hesitate to contact us if you require any additional support.

    Thank you.

    Thank you Tammy,

    Fast and useful reply! I ask you just one more thing.

    What is already set as default in robots.txt –> “# This file is automatically added by Rank Math […]” etc.

    Do I need to rewrite that, and then add the disallow declaration at the bottom?

    Or can I just add the disallow declaration and let the default message disappear?

    Hello,

    Thank you for your patience.

    Yes, you would need to rewrite the default robots.txt generated there and add the disallow rule. Your robots.txt should look like this:

    User-agent: *
    Disallow: /wp-admin/
    Disallow: *.pdf
    Allow: /wp-admin/admin-ajax.php
    Sitemap: yoursite.com/sitemap_index.xml

    Remember to update the yoursite.com line with your actual website name.

    I hope that helps.

    Thank you, and please don’t hesitate to contact us anytime if you need further assistance with anything else.

    Thanks for the support guys!

    Ankit
    Rank Math business

    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 5 replies - 1 through 5 (of 5 total)

The ticket ‘How to noindex media files (pdf file in specific)’ is closed to new replies.