user13614523
user13614523

Reputation: 31

How to remove 'X-Robots-Tag' http header in Symfony 5

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

Answers (2)

Ilyich
Ilyich

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

Muamet Islami
Muamet Islami

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

source

Upvotes: 2

Related Questions