dev-master
9999999-devRobots.txt generator for Symfony 2 & 3
MIT
The Requires
The Development Requires
bundle symfony robots robots.txt
Robots.txt generator for Symfony 2 & 3
SensioLabsInsight | Style-CI | Travis CI | Coverage | Downloads | Release |
---|---|---|---|---|---|
It's pretty common workflow that we work on our projects in local
environment, then deploy code to preproduction
or staging
server for out client to approve the work, then finally push to production
environment., (*1)
While we absolutely want crawlers to index our production
environment, we don't want to see our test servers in search results., (*2)
Depending on the Symfony environment, application will return robots.txt
file with rule that allows to index whole content only we are in prod
environment. In case of another environment, the application will block whole site from indexing., (*3)
First, open a command console, enter your project directory and execute the following command to download the latest version of this bundle:, (*4)
composer require miisieq/robots-txt-bundle
Then add the bundle to your kernel:, (*5)
class AppKernel extends Kernel { public function registerBundles() { $bundles = [ // ... new Miisieq\RobotsTxtBundle\MiisieqRobotsTxtBundle(), ]; // ... } }
Add the following to your config file:, (*6)
``` yaml, (*7)
miisieq_robots_txt: ~, (*8)
You can easily add links to your site maps: ``` yaml # app/config/config.yml miisieq_robots_txt: host: http://example.com production_environment: prod sitemaps: - "/sitemap.xml" - "/catalog/sitemap.xml"
To allow to get your robots.txt
file, register the following route:, (*9)
# app/config/routing.yml miisieq_robots_txt: resource: "@MiisieqRobotsTxtBundle/Resources/config/routes.yaml" prefix: /
robots.txt
file (if exists)rm web/robots.txt
Robots.txt generator for Symfony 2 & 3
MIT
bundle symfony robots robots.txt