3

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?

John Conde
  • 217,595
  • 99
  • 455
  • 496

2 Answers2

2

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

  • Muamet Islami Thank for replying.. i have already changed APP_ENV=prod , When i have tried to run ``` APP_ENV=prod APP_DEBUG=0 php bin/console cache:clear ``` i was getting error APP_ENV is not recognized as an internerl or external command so i have run command without APP_ENV=prod APP_DEBUG=0 but same issue exists – user13614523 Jun 30 '20 at 14:50
1

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
Ilyich
  • 4,966
  • 3
  • 39
  • 27