0

I have multiple sites running on a single code base in Drupal 8. Is there any possible way to add different robots.txt file for each site?

  • I have multiple sites running on a single code care to mention how you managed to do this? – No Sssweat Jan 23 '19 at 7:51
0

If you are under apache, you can use mod_rewrite to deliver others robots.txt :

  RewriteCond %{HTTP_HOST} ^domain1.com$
  RewriteRule ^robots.txt$ robots.domain1.com.txt [L]
  RewriteCond %{HTTP_HOST} ^domain2.com$
  RewriteRule ^robots.txt$ robots.domain2.com.txt [L]

Note you may also generate your robots.txt in some controller for each site depends on config and fallback to default if not defined.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.