wordpresswordpress-media

how to disallow Specefic url Being index


i have about 200 URLs distributed in /3/2024 Folder with ".torrent" suffix (wordpress knowen as ducument)

Like : https://website/wp-content/uploads/2024/03/diffrent_names.torrent

Recently i got crawled and not index from Google S-console. How Can i prevent index just this Type of files ? changes in robot.txt or Specific php code maybe ?


Solution

  • You can add rules to your robots.txt file to disallow search engines from crawling the .torrent files. However, keep in mind that this method relies on the cooperation of search engine bots and is not entirely foolproof. Add the following lines to your robots.txt file:

    User-agent: *
    Disallow: /wp-content/uploads/2024/03/*.torrent
    

    This rule tells all compliant search engine bots not to crawl any URLs that match the pattern ending with .torrent in the specified folder.