My robots.txt URL Returns a 404 Error

#842903
  • Resolved Carly Jennings
    Rank Math free

    Hi,

    I am getting a ‘not found’ error on my robots.txt

    I recently deleted the existing robots.txt file using an FTP application and am now getting a 404 error.

    Please can you advise how I fix this?

    Thank you,
    Carly

    My website is https://grandboats.com.au

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    We apologize for the issue you are facing with your robots.txt file returning a 404 error. Since you have deleted the existing robots.txt file, it may indicate that there is a conflict with another robots.txt file or a redirection issue.

    Here are the steps you can take to resolve this:

    1. Check for Another robots.txt File: Ensure that there are no other robots.txt files in your site’s root directory. You can do this by logging into your WordPress root directory using cPanel or an FTP application. If you find another robots.txt file, please delete it.

      Navigate to File Manager in cPanel

    2. Clear Cache: After ensuring there are no conflicting files, clear your website and server-level cache. This can help in reflecting the changes made.

    3. Add Rewrite Rules: If your root directory does not contain a robots.txt file, you may need to add the applicable rewrite rule to your .htaccess file. Hereā€™s how:

      • For Apache servers, add the following rule:
        RewriteRule ^robots.txt$ /index.php?robots=1 [L]
      • For Nginx servers, use:
        # START Nginx Rewrites for Rank Math Robots.txt File
        rewrite ^/robots.txt$ /?robots=1 last;
        rewrite ^/([^/]+?)-robots([0-9]+)?.txt$ /?robots=$1&robots_n=$2 last;
        # END Nginx Rewrites for Rank Math Robots.txt File
    4. Test Your robots.txt URL: After making these changes, visit https://yourdomain.com/robots.txt to see if it loads correctly.

    If you continue to experience issues, please reply to this ticket, and a human agent from the Rank Math Support team will assist you further.

    Thank you for raising this concern!

    Sources:
    Common robots.txt Issues & How to Fix Them Ā» Rank Math

    Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    We’ve tested your Rank Math robots file on the following URL: https://grandboats.com.au/?robots=1 and itā€™s working properly without any issues. It looks like the rewrite rules for the robots file might not be working on your site. Please add the following rewrite rules to your website:

    # For Nginx server:

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

    Hereā€™s an article you can check as well: https://ubiq.co/tech-blog/rewrite-url-parameters-nginx/

    # For Apache server:

    # START of Rank Math Robots.txt Rewrite Rules
    RewriteEngine On
    RewriteBase /
    RewriteRule ^robots.txt$ /index.php?robots=1 [L]
    # END of Rank Math Robots.txt Rewrite Rules
    

    If you’re not sure how to apply this rule, you can get in touch with your hosting provider to do that for you.

    Let us know how it goes. Looking forward to helping you.

    Thank you.

    Hi,

    Thank you for the above. I contacted my hosting provider and the robots.txt no longer appears to be appearing as a 404 https://grandboats.com.au/robots.txt

    Thank you,
    Carly

    Hello,

    That’s great to hear! We’re glad the issue is resolved.

    If you have any other questions or need further assistance, feel free to reach out.

    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 ‘My robots.txt URL Returns a 404 Error’ is closed to new replies.