nox-it / yii2-nox-robots
此包已被弃用且不再维护。未建议替代包。
Yii2 Robots.txt 生成模块
2.0.0
2020-05-03 16:01 UTC
Requires
- php: >=7.4.0
- nox-it/yii2-nox: ~2.0.0
- nox-it/yii2-nox-helpers: ~2.0.0
- nox-it/yii2-nox-mvc: ~2.0.0
This package is auto-updated.
Last update: 2022-06-01 20:12:04 UTC
README
自动生成 robots.txt 文件的 Yii2 模块。
安装
通过 composer 安装此扩展是首选方法。
- 运行以下命令之一
php composer.phar require --prefer-dist "nyx-solutions/yii2-nyx-robots" "*"
或添加以下内容到您的应用 composer.json 文件的 require 部分
"nyx-solutions/yii2-nyx-robots": "*"
使用
- 配置应用程序配置文件中的
cache组件,例如
'components' => [ 'cache' => [ 'class' => 'yii\caching\FileCache', ], ]
- 在应用程序配置文件的
modules部分中添加新模块,例如
'modules' => [ 'robots' => [ 'class' => 'nyx\modules\robots\Module', 'settings' => [ 'disallowAllRobots' => false, 'allowAllRobots' => false, 'useSitemap' => true, 'sitemapFile' => '/sitemap.xml', 'robots' => [], 'allowRules' => [ 'all' => [ '/uploads' ] ], 'disallowRules' => [ 'all' => [ '/assets' ] ] ] ] ]
- 在应用程序配置文件的
urlManager中添加新规则,例如
'urlManager' => [ 'rules' => [ ['pattern' => 'robots', 'route' => 'robots/default/index', 'suffix' => '.txt'], ] ]
许可证
yii2-nyx-robots 在 BSD 3-Clause 许可证下发布。有关详细信息,请参阅捆绑的 LICENSE.md 文件。