PHPackages                             ricbra/robots-txt-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ricbra/robots-txt-bundle

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ricbra/robots-txt-bundle
========================

Simple Symfony2 which generates robots.txt based on config setting

2.0.1(10y ago)45.5k[1 issues](https://github.com/ricbra/robots-txt-bundle/issues)MITPHP

Since Oct 29Pushed 8y ago1 watchersCompare

[ Source](https://github.com/ricbra/robots-txt-bundle)[ Packagist](https://packagist.org/packages/ricbra/robots-txt-bundle)[ RSS](/packages/ricbra-robots-txt-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

RicbraRobotsTxtBundle
=====================

[](#ricbrarobotstxtbundle)

After solving the same problem for the fifth time I thought it was time to create a Bundle for this problem. I did again an extensive search on any other available material but I guess everybody is solving this problem on his own. On KnpBundles.com and Packagist.org I couldn't find any Bundle for this. So I created this one instead.

### The problem: your staging environment indexed in Google

[](#the-problem-your-staging-environment-indexed-in-google)

We all have some different environments for your apps (staging, test, dev) and we all have experienced this in the past: Google indexed your staging environment and every now and then a real visitor ends up there. Of course you can IP-block the staging but this isn't always feasible.

### Solution for Symfony2: configurable robots.txt

[](#solution-for-symfony2-configurable-robotstxt)

Update your config.yml:

```
ricbra_robots_txt:
    allow_robots: %allow_robots%

```

In your parameters.yml file for production:

```
allow_robots: true

```

In your staging|dev|test parameters file:

```
allow_robots: false

```

Not really rocket science, but it works.

Installation
------------

[](#installation)

Composer ftw:

```
$ composer require ricbra/robots-txt-bundle

```

Then enable the bundle:

```
