Skip to content

Middleware to avoid search engine indexing with PSR-7 using robots.txt and X-Robots-Tag

License

Notifications You must be signed in to change notification settings

php-middleware/block-robots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

block-robots middleware Build Status

PSR-15 middleware to avoid search engine indexing with PSR-7

This middleware provide framework-agnostic possibility to preventing your site from being indexed.

How it works?

  • Add X-Robots-Tag header with noindex, nofollow value.
  • Add robots.txt "file" with User-Agent: * Disallow: / body

Installation

composer require php-middleware/block-robots
$blockRobotsMiddleware = new PhpMiddleware\BlockRobots\BlockRobotsMiddleware();

$app = new MiddlewareRunner();
$app->add($blockRobotsMiddleware);
$app->run($request, $response);

It's just works with any modern php framework!

Middleware tested on:

Middleware should works with:

And any other modern framework supported middlewares and PSR-7.