Robots.txt for Wordpress on Subfolder

#29749
  • Resolved Gaurav
    Rank Math pro

    Hi Team,

    I have a main site that has url say http://www.example.com/

    The wordpress blog is on a subdirectory using reverse proxy http://www.example.com/blog

    Now as per my understanding, robots.txt needs to be at web root (www.example.com/robots.txt) so I have couple of questions regarding the same.

    1) 404 monitor shows a lot of hits to wordpress robots.txt (www.example.com/blog/robots.txt) I am not sure from where are they coming? are they internal from rankmath trying to create a virtual robots.txt in wordpress root?

    2) Now I need to copy and paste the recommended robots.txt settings from rankmath to root robots at http://www.example.com/robots.txt by appending /blog to them like below?
    # This file is automatically added by Rank Math SEO plugin to help a website index better
    # More info: https://s.rankmath.com/home
    User-Agent: *
    Disallow: /blog/wp-admin/
    Allow: /blog/wp-admin/admin-ajax.php

    Also, since this would be a common issue, with wordpress being on subfolder and Rankmath not able to create robots.txt, can some sort of check be developed so that we can manually implement these changes in root robots.txt?

    Regards,
    Gaurav

    • This topic was modified 4 years, 8 months ago by Gaurav. Reason: Notification of actual URL to RM team
Viewing 7 replies - 1 through 7 (of 7 total)
  • Todd
    Rank Math free

    Hi Gaurav,

    Thanks for getting in touch with us.

    1. Rank Math only monitors 404. We do not create them or track why they are generated. You have to check that yourself. You can enable the Advanced monitor to check more details on where the 404s are referred from at WordPress Dashboard > Rank Math > General Settings > 404 Monitor.

    2. What is your site URL at WordPress Dashboard > Settings > General?

    Most of the users have a single WP installation, use the domain.com for some static page and use posts page for the blog. We will still take a closer look at this and fix it with an update if needed.

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

    Hi Todd,

    Thanks for your reply. I would enable the advanced monitor to check that.

    The Site URL and WordPress URL on our installation both contain the subdirectory url like http://www.example.com/blog/ As mentioned earlier, the blog is hosted using a reverse proxy to a subfolder installation.

    Warm Regards,
    Gaurav

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    Hello,

    Thank you for contacting Rank Math today.

    I have submitted this info to our dev team and we will be in touch in a short while.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    The robots.txt file should be in the top directory of your web server. When web crawlers looks for the “/robots.txt” file for URL, it strips the path component from the URL (everything from the first single slash), and puts “/robots.txt” in its place. So even if it’s a sub-directory installation, the robots.txt should be accessible from the main URL. You can read more about it on the official robotstxt.org site

    Also in Rank Math, we use robots_txt filter to add the content, and if the Robots.txt file exists on the server then in Rank Math the option to edit the Robots.txt file gets disabled. We are doing this to prevent the user from overwriting the file.

    I hope that clears the confusion. If there’s anything else, please let us know.

    Thank you.

    Hi Pratik / Michael,

    It seems that these requests were generated by Hummingbird cache plugin and a few bots.

    I’ll raise the issue with WPMU team so that the cache pregenerator takes into consideration that WordPress is installed in a subfolder and hits are avoided.

    Meanwhile, I’ll add a redirect so that the wrong reqeusts are directed to root robots.

    Thanks for your help guys.

    Hello,

    We are super happy that this resolved your issue. If you have any other questions in the future, know that we are here to help you.

    If you don’t mind me asking, could you please leave us a review (if you haven’t already) on https://wordpress.org/support/plugin/seo-by-rank-math/reviews/#new-post about your overall experience with Rank Math? We appreciate your time and patience.

    If you do have another question in the future, please feel free to create a new forum topic, and it will be our pleasure to assist you again.

    Thank you.

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

The ticket ‘Robots.txt for Wordpress on Subfolder’ is closed to new replies.