I have set below route:
Route::get('robots.txt', 'MainController@robots');
In the controller I have this function:
public function robots() {
header('Content-Type: text/plain');
echo 'User-agent: *';
echo PHP_EOL;
echo 'Allow: /';
echo PHP_EOL;
}
But when accessed via http://ift.tt/1sMWKqc It throws below error:
Exception 'ErrorException' with message 'Cannot modify header information - headers already sent by (output started at /home/domain/public_html/vendor/symfony/http-foundation/Response.php:1156)
So want to set the header header('Content-Type: text/plain'); in the routes.php to fix this problem. But my question is how?
Or is there a better approach?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2l0Shnf
via IFTTT
Aucun commentaire:
Enregistrer un commentaire