Kohana: What is the best way to serve robots.txt?
-
12-12-2019 - |
Question
In our web app we're redirecting all 404's to a pretty error page, but for robots.txt we need to server a default page (or return 404), else google won't index us.
Should I be adding a route to bootstrap.php specifically for http://www.mydomain.com/robots.txt?
Or should I be doing this through .htaccess?
Was there a cleaner approach I overlooked?
Solution
Just create the file. If .htaccess is configured correctly, the Kohana framework only comes to action if there is no 'direct hit' on the requested file.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow