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

admin2025-06-05  3

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:
Site Url:

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: /...).

URL for a page is: www.example/mypage/
NOT: www.example/wordpress/mypage/
but image link is: www.example/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)
or its wordpress directory (example/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.

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/wordpress
Site Url: https://www.example

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/wordpress/wp-content/uploads/...).

URL for a page is: www.example/mypage/
NOT: www.example/wordpress/mypage/
but image link is: www.example/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)
or its wordpress directory (example/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.

Share Improve this question asked Dec 9, 2018 at 0:45 SherylHohmanSherylHohman 8419 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

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/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

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749114961a316489.html

最新回复(0)