Where to put robot.txt and sitemap.xml for wordpress installed in its own directory

My website is setup where wordpress is installed in it's own subdirectory, but the content is served as though it's at the domain root.
(This wordpress codex page details the configuration)

Wordpress Url: https://www.example.com/wordpress
Site Url: https://www.example.com

So in this case, urls get re-written to NOT include /wordpress in the url it serves pages from (although image urls do include it: https://www.example.com/wordpress/wp-content/uploads/...).

URL for a page is: www.example.com/mypage/
NOT: www.example.com/wordpress/mypage/
but image link is: www.example.com/wordpress/wp-content/uploads/2018/12/25/image1.jpg

Question:
Do I put robots.txt and sitemap.xml in the "webiste root" directory on my server (example.com)
or its wordpress directory (example.com/wordpress) ?

I cannot find this particular case in any searches.
Also trial and error is not helping, because I get conflicting results from various sitemap and robot validators.

Additionally, it seems some plugin or some part of WordPress insists on creating Virtual sitemap (sitemap.xml.gz) and robot (robot.txt) files, which further exasperates my efforts to definitively determine the proper location to place these files for this common, but non-standard of setup.

Topic sitemap robots.txt directory Wordpress

Category Web


You can safely place your robot.txt file as well as the sitemap.xml file into your websites root directory and NOT the WordPress directory.

When a robot visits your site, the first place it checks is http://sitename.com/robots.txt, hence you want to keep these files at the root of your domain.

You can also disallow what the robot has access to

    User-agent: *    # applies to all robots
    Disallow: /      # disallow indexing of all pages

    Disallow: wordpress/wp-admin/
    Disallow: wordpress/wp-includes/
    Disallow: wordpress/wp-content/plugins/

W3.org

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.