3 years ago

Laravel 5 Route for robots.txt

Posted 3 years ago by okawei

I have a multi tenant application which changes styles/content based on the host name. This also means that there is a different sitemap for each site. In order to have a different sitemap for each site I'm going to need to have a dynamically served robots.txt file which updates the sitemap url depending on the current site it's in.

I've tried this:

Route::get('robots.txt', function(){
    echo "Here!";

But the route always throws a 404 (https://www.dropbox.com/s/97kdwnxz1383i3a/Screenshot%202016-02-03%2008.08.07.png?dl=0)

Please sign in or create an account to participate in this conversation.