Reputation: 31
I am developing a project using the Symfony 5 framework. I have deployed that code to production. When I am trying to add website to google search engine then I am getting:
Error "No: 'noindex' detected in 'X-Robots-Tag' http header"
I have changed the environment from dev to production but still I am getting the same error. I have tried to disable disallow_search index but this method is also not working
disallow_search_engine_index: false
How can change X-Robots-Tag header in Symfony 5?
Upvotes: 3
Views: 3011
Reputation: 5776
Maybe you tried to disallow search engine index in the wrong file.
This worked for me:
config/packages/framework.yaml
framework:
# ...
disallow_search_engine_index: false
Upvotes: 1
Reputation: 21
Make sure you set the APP_ENV to prod in .env file like this:
APP_ENV=prod
And clear your cache with this command:
APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear
Apparently Symfony blocks search engines if it is in development mode
Upvotes: 2