Robots.txt

#577959
  • Resolved Fdl
    Rank Math free

    Hello,

    I want to disallow comment pages, archives pages and pages with internal searches parameters.

    1) Do the default robots.txt rules take into account theses rules or should I add them ?

    2) If I have to add them, would it be ok to add this ?

    Disallow: */comment-
    Disallow: /archives/
    Disallow : search?qu=[mot clé]

    3) Should I rewrite the default rules too ?

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

    Thanks a lot

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math support.

    We are happy to help you with your robots.txt file.

    To answer your questions:

    1. The default robots.txt rules do not take into account the rules you want to add. You need to add them manually if you want to disallow comment pages, archives pages, and pages with internal search parameters.
    2. Yes, you can add those rules to your robots.txt file. However, you need to make sure that the syntax is correct and that you use a wildcard (*) after the Disallow directive. For example:
      Disallow: */comment-*
      Disallow: /archives/*
      Disallow: /search?qu=*
    3. Also, you need to replace [mot clé] with the actual keyword parameter that your site uses for internal searches. For example, if your site uses /search?q=keyword, then you need to use:

      Disallow: /search?q=*

    4. No, you don’t need to rewrite the default rules. You can keep them as they are and add your custom rules below them. The final robots.txt file would look something like this:
      User-agent: *
      Disallow: /wp-admin/
      Allow: /wp-admin/admin-ajax.php
      Disallow: */comment-*
      Disallow: /archives/*
      Disallow: /?s=*
      Sitemap: yoursite.com/sitemap_index.xml

    We hope this helps. If you have any trouble with the robots.txt file or need further assistance, please let us know.

    Have a great day!

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

The ticket ‘Robots.txt’ is closed to new replies.