Search code examples
phpweb-applicationskohanarobots.txtkohana-3.2

Kohana: What is the best way to serve robots.txt?


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.