Hello, fellow Cake enthusiasts. I have a quick question. I would like to have a dynamic robots.txt file. For this, I have created a custom route in the
Router::connect('/robots', array('controller' => 'pages','action' => 'robots', 'ext' => 'txt'));
It keeps giving me a 404, but it’s like the Apache 404. It seems like it’s not going to Cake … any ideas?
Thank you for your help, i have been wrapping my head for hours now…
I finally found out why i was getting a 404. In my apache config i had MultiViews enabled
Apache website, the effect of Multiviews, as listed under Content Negotiation, is as follows:
If the server receives a request for /some/dir/foo, if /some/dir has MultiViews enabled, and /some/dir/foo does not exist, then the server reads the directory looking for files named foo.*, and effectively fakes up a type map which names all those files, assigning them the same media types and content-encodings it would have if the client had asked for one of them by name. It then chooses the best match to the client’s requirements.
You should not need to make a route for it tho as Apache2 should just serve them if it’s found as a static-file
Its not a static file, moving away from a static file to a dynamic one