Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
Symfony route to file misunderstanding

I had an intention to dynamically generate a robots.txt file for different domain names.

I removed the file from /web/ directory. I added

bits_cb.common:
    resource: "@BitsClientoboxBundle/Controller/CommonController.php"
    type: annotation

to routing.yml.

I added

/**
 * @Route("/robots.txt", name="robots")
 * @param Request $request
 */
public function indexAction(Request $request)
{
 //
}

to CommonController.php.

The debug:router console command there is route:

robots    ANY    ANY    ANY    /robots.txt

But if I try to get from http://{{sitename}}/robots.txt it returns 404. To be sure, if I change

* @Route("/robots.txt", name="robots")

to

* @Route("/robots", name="robots")

and get from http://{{sitename}}/robots it works okay.

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!