How can I disable the robots.txt

#22119
  • Resolved Russell Strange
    Rank Math free

    I use better robots.txt but there is a conflict with the RankMath robots.txt. Is there a way to disable RankMath robots.txt?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math today.

    Rank Math manages the sitemap dynamically and you can disable it by creating a static robots.txt file on the root of your site.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Russell Strange
    Rank Math free

    I need a programmatic solution as better robots.txt also creates a virtual file.

    Thank you,
    Rusty

    Michael Davis
    Rank Math pro

    Hi Russell,

    Thanks for the mail.

    Kindly allow me to consult the dev on this and then I’ll get back to you.

    Someone will be getting back to you soon.

    Todd
    Rank Math free

    Hello,

    Please create a new file in your theme’s folder and name it rank-math.php

    Then, add the below code inside to disable the robots.txt feature of Rank Math:

    <?php
    
    add_filter(
    	'rank_math/modules',
    	function( $modules ) {
    		unset( $modules['robots-txt'] );
    		return $modules;
    	}
    );

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 4 replies - 1 through 4 (of 4 total)

The ticket ‘How can I disable the robots.txt’ is closed to new replies.