robots.txt rules rewrite

#338433
  • Resolved Ian Ong
    Rank Math free

    My client website is on a nginx server. i found documentation about the URL rewrites to solve the issue.

    is there a rewrite rules for robots.txt?

    this issue is affecting robots.txt as well because rank math generated robots.txt file on a dynamic URL

    http://www.abc.com/?robots=1

Viewing 3 replies - 1 through 3 (of 3 total)
  • Prabhat
    Rank Math agency

    Hello,

    Thank you for contacting us.

    We generate the robots.txt on the URL domain.com/robot.txt. I checked and it is accessible on your website on the same URL.

    Could you describe the issue that your client is facing?

    Looking forward to helping you.

    Thank you.

    The URL is yojee.com.

    the robots.txt can only can be found via this url at first.
    https://yojee.com/?robots=1

    initially https://yojee.com/robots.txt file is returning an 404 error. similarly to XML sitemap issue on nginx server.

    couldnt find a resource about URL rewrite for robots.txt. only manage to find the URL rewrites rule for sitemap issue.

    so i created my own version
    # START Nginx Rewrites for Rank Math Robots.txt File
    rewrite ^/robots.txt$ /index.php?robots=1 last;
    rewrite ^/([^/]+?)-robots([0-9]+)?.txt$ /index.php?robots=$1&robots_n=$2 last;
    # END Nginx Rewrites for Rank Math Robots.txt File

    it is now resovled.

    hope you guys can add this in your KB as well.

    Hello,

    We are glad that you have found a workaround for your current issue. We will take note of the workaround that you have applied for your website to resolve the issue.

    With that said, if you have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you.

    Thank you.

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

You must be logged in to reply to this ticket.