My question is about how I should build robots.txt
for my Web site.
Not so long ago, I used to only disallow a few pages like this:
User-agent: *
Disallow: /webapp_1/page_1_1_d.jsp
Disallow: /webapp_1/page_1_2_d.jsp
[...]
Disallow: /webapp_1/page_1_n1_d.jsp
Disallow: /webapp_2/page_2_1_d.jsp
Disallow: /webapp_2/page_2_2_d.jsp
[...]
Disallow: /webapp_2/page_2_n2_d.jsp
Recently, I decided instead, to make a list of the pages I wanted to allow and to disallow all the rest, like this:
User-agent: *
Allow: /sitemap.xml
Allow: /webapp_1/page_1_1.jsp
Allow: /webapp_1/page_1_2.jsp
[...]
Allow: /webapp_1/page_1_n3.jsp
Allow: /webapp_2/page_2_1.jsp
Allow: /webapp_2/page_2_2.jsp
[...]
Allow: /webapp_2/page_2_n4.jsp
Disallow: /
In all, I allowed 182 pages that way.
Using Google Search Console
, I notice that 256 pages are marked as Blocked by robots.txt
.
After checking them, I concluded that I indeed, do not want bots to crawl and index these pages because of the following reasons:
- CASE 1 -
https://my_website.com/webapp/page.jsp?query_string
(=> I allowedhttps://my_website.com/webapp/page.jsp
(I would like bots to crawl and index it), why is the bot trying to crawl and index that page with a query string ? (Please note that I use these query strings in my webapps.)) - CASE 2 -
https://my_website.com/webapp/page_not_allowed.jsp?query_string
(=> I didn't allowhttps://my_website.com/webapp/page_not_allowed.jsp
) - CASE 3 -
https://my_website.com/webapp/suppressed_page.jsp
(=> I suppressed this page.) - CASE 4 -
https://my_website.com/page.jsp
(=>page.jsp
doesn't physically exist at that level, instead it exists here:https://my_website.com/webapp/page.jsp
and is allowed.) - CASE 5 -
https://my_website.com/webapp/folder/doc.pdf
(=> I don't need thatPDF
document to be crawled and indexed by bots.) - CASE 6 -
https://my_website.com/webapp/not_allowed_page.jsp
(=> I didn't allow this page on purpose.) - CASE 7 -
https://my_website.com/
andhttps://www.my_website.com/
(=> I don't know if this is a problem since visiting these URLs leads tohttps://my_website.com/webapp_1/
, setting I made on purpose.) - CASE 8 -
http://my_website.com/
andhttp://www.my_website.com/
(=>HTTP
... my website is anHTTPS
website.)
Shall I build robots.txt
another way?
What can I do to avoid these issues?