laravel-robots-manager maintained by djstarcom
Description
Laravel robots.txt manager
Author
Last update
2021/06/16 08:30
(dev-master)
License
Downloads
2
Tags
Laravel robots.txt manager
Installation
First, install the package via composer:
composer require "djstarcom/laravel-robots-manager"
The package will automatically register itself.
Usage
Delete projects default public/robots.txt
Add the following to your routes file:
Route::get('robots.txt', function ()
{
if (App::environment() == 'production') {
// If on the live server, serve a nice, welcoming robots.txt.
RobotsManager::addUserAgent('*');
RobotsManager::addSitemap('sitemap.xml');
} else {
// If you're on any other server, tell everyone to go away.
RobotsManager::addDisallow('*');
}
return Response::make(RobotsManager::generate(), 200, ['Content-Type' => 'text/plain']);
});
Refer to the RobotsManager.php for API usage.
