t3n / seo-routing
Flow Framework 路由器以确保带有尾部斜杠
4.0.1
2023-07-03 08:39 UTC
Requires
- guzzlehttp/psr7: ^1.8
- neos/flow: ^7.3
Requires (Dev)
- t3n/coding-standard: ~1.1.0
This package is auto-updated.
Last update: 2024-09-03 10:56:32 UTC
README
t3n.SEO.Routing
本包有2个主要功能
- trailingSlash: 确保所有链接都以尾部斜杠结尾(例如
example.com/test/
而不是example.com/test
) - toLowerCase: 确保camelCase链接重定向到小写(例如
exmaple.com/lowercase
而不是exmaple.com/lowerCase
)
您可以选择启用和禁用这两个功能。
另一个小功能是限制所有 新 neos 页面都具有小写的 uriPathSegment
。这是通过扩展 NodeTypes.Document.yaml
来实现的。
安装
只需通过composer要求即可:
composer require t3n/seo-routing
配置
标准配置
在标准配置中,我们已激活了trailingSlash(将所有不以/结尾的uri重定向到以/结尾的uri),并使用301 http状态进行所有重定向。
注意:默认情况下,小写重定向是禁用的,因为您必须确保没有带有camelCase或大写字母的uriPathSegment
- 这会导致重定向到无法到达的地方。
t3n:
SEO:
Routing:
redirect:
enable:
trailingSlash: true
toLowerCase: false
statusCode: 301
blacklist:
'/neos/.*': true
重定向的黑名单
默认情况下,所有/neos/
URL都会被忽略进行重定向。您可以根据需要使用正则表达式扩展黑名单数组。
t3n: SEO: Routing: #redirect: #... blacklist: '/neos/.*': true