The simplest setup robots.txt in Drupal 8

In order to completely block the site from being indexed, put the following in the robots.txt file:

User-agent: *
Disallow: /

If you want to open the site, you can use the standard robots.txt that Drupal 8 provides:

#
# robots.txt
#
# This …


This content originally appeared on DEV Community and was authored by Vadim Filimonov

In order to completely block the site from being indexed, put the following in the robots.txt file:

User-agent: *
Disallow: /

If you want to open the site, you can use the standard robots.txt that Drupal 8 provides:

#
# robots.txt
#
# This file is to prevent the crawling and indexing of certain parts
# of your site by web crawlers and spiders run by sites like Yahoo!
# and Google. By telling these "robots" where not to go on your site,
# you save bandwidth and server resources.
User-agent: *
# CSS, JS, Images
Allow: /misc/*.css$
Allow: /misc/*.css?
Allow: /misc/*.js$
Allow: /misc/*.js?
Allow: /misc/*.gif
Allow: /misc/*.jpg
Allow: /misc/*.jpeg
Allow: /misc/*.png
Allow: /modules/*.css$
Allow: /modules/*.css?
Allow: /modules/*.js$
Allow: /modules/*.js?
Allow: /modules/*.gif
Allow: /modules/*.jpg
Allow: /modules/*.jpeg
Allow: /modules/*.png
Allow: /profiles/*.css$
Allow: /profiles/*.css?
Allow: /profiles/*.js$
Allow: /profiles/*.js?
Allow: /profiles/*.gif
Allow: /profiles/*.jpg
Allow: /profiles/*.jpeg
Allow: /profiles/*.png
Allow: /themes/*.css$
Allow: /themes/*.css?
Allow: /themes/*.js$
Allow: /themes/*.js?
Allow: /themes/*.gif
Allow: /themes/*.jpg
Allow: /themes/*.jpeg
Allow: /themes/*.png
# Directories
Disallow: /includes/
Disallow: /misc/
Disallow: /modules/
Disallow: /profiles/
Disallow: /scripts/
Disallow: /themes/
# Files
Disallow: /CHANGELOG.txt
Disallow: /cron.php
Disallow: /INSTALL.mysql.txt
Disallow: /INSTALL.pgsql.txt
Disallow: /INSTALL.sqlite.txt
Disallow: /install.php
Disallow: /INSTALL.txt
Disallow: /LICENSE.txt
Disallow: /MAINTAINERS.txt
Disallow: /update.php
Disallow: /UPGRADE.txt
Disallow: /xmlrpc.php
# Paths (clean URLs)
Disallow: /admin/
Disallow: /comment/reply/
Disallow: /filter/tips/
Disallow: /node/add/
Disallow: /search/
Disallow: /user/register/
Disallow: /user/password/
Disallow: /user/login/
Disallow: /user/logout/
# Paths (no clean URLs)
Disallow: /?q=admin/
Disallow: /?q=comment/reply/
Disallow: /?q=filter/tips/
Disallow: /?q=node/add/
Disallow: /?q=search/
Disallow: /?q=user/password/
Disallow: /?q=user/register/
Disallow: /?q=user/login/
Disallow: /?q=user/logout/
Sitemap: https://site.com/sitemap.xml

Where Host and Sitemap - links to the domain and sitemap.xml, respectively.


This content originally appeared on DEV Community and was authored by Vadim Filimonov


Print Share Comment Cite Upload Translate Updates
APA

Vadim Filimonov | Sciencx (2022-03-22T13:02:36+00:00) The simplest setup robots.txt in Drupal 8. Retrieved from https://www.scien.cx/2022/03/22/the-simplest-setup-robots-txt-in-drupal-8/

MLA
" » The simplest setup robots.txt in Drupal 8." Vadim Filimonov | Sciencx - Tuesday March 22, 2022, https://www.scien.cx/2022/03/22/the-simplest-setup-robots-txt-in-drupal-8/
HARVARD
Vadim Filimonov | Sciencx Tuesday March 22, 2022 » The simplest setup robots.txt in Drupal 8., viewed ,<https://www.scien.cx/2022/03/22/the-simplest-setup-robots-txt-in-drupal-8/>
VANCOUVER
Vadim Filimonov | Sciencx - » The simplest setup robots.txt in Drupal 8. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/03/22/the-simplest-setup-robots-txt-in-drupal-8/
CHICAGO
" » The simplest setup robots.txt in Drupal 8." Vadim Filimonov | Sciencx - Accessed . https://www.scien.cx/2022/03/22/the-simplest-setup-robots-txt-in-drupal-8/
IEEE
" » The simplest setup robots.txt in Drupal 8." Vadim Filimonov | Sciencx [Online]. Available: https://www.scien.cx/2022/03/22/the-simplest-setup-robots-txt-in-drupal-8/. [Accessed: ]
rf:citation
» The simplest setup robots.txt in Drupal 8 | Vadim Filimonov | Sciencx | https://www.scien.cx/2022/03/22/the-simplest-setup-robots-txt-in-drupal-8/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.