2

My website uses a contextpath (eg: www.example.com/abc). The robots.txt is available at www.example.com/abc/robots.txt and I have given a 301 redirect in webserver to redirect www.example.com/robots.txt to www.example.com/abc/robots.txt.

My question is whether the search engines be able to read the robots.txt file since it has a 301 redirect?

unor
  • 92,415
  • 26
  • 211
  • 360
Aromal
  • 176
  • 2
  • 8

2 Answers2

1

Found that the search engines are honoring the 301 redirect and reading the file from the subfolder.

Aromal
  • 176
  • 2
  • 8
  • I observe the same. It seems Google Search Console tool https://www.google.com/webmasters/tools/robots-testing-tool does not complain. – pixeline Jul 27 '22 at 09:29
0

Robots.txt should be on root level

https://example.com/robots.txt - Correct
https://blog.example.com/robots.txt - Correct
https://example.com/abc/robots.txt - Not Correct
https://blog.example.com/abc/robots.txt - Not Correct

If it is on sub directory/sub folder then it will return 404 error(Because they make calls only on root directory), and Google will ignore your robots.txt completely if it is return 301 or 404 error.

Goyllo
  • 331
  • 3
  • 15