netlogix / errorhandler
5.1.0
2024-08-20 09:01 UTC
Requires
- php: ^7.3 || ^8.0
- ext-curl: *
- guzzlehttp/guzzle: ~6.0 || ~7.0
- neos/flow: ^7.3.2 || ^8.0
- neos/neos: ^7.3 || ^8.0
Suggests
- netlogix/sentry: Log exceptions to sentry
This package is auto-updated.
Last update: 2024-09-23 16:53:15 UTC
README
此包允许您使用Neos页面的内容生成静态错误页面。这些静态文件将根据其配置用于Flow & Neos的错误处理。
您还可以将这些文件用作Web服务器的ErrorDocument。
安装包
composer require netlogix/errorhandler
配置
为每个网站和所需的每个状态代码提供配置
Netlogix: ErrorHandler: pages: # siteNodeName of all Sites that you want to generate error pages for 'my-site-without-dimensions': - # The status codes this error page is generated for matchingStatusCodes: [404, 410] # Dimensions to use for this error page. Use empty array if no dimensions are configured dimensions: [] # Node identifier of documentNode to use for rendering source: '#550e8400-e29b-11d4-a716-446655440000' # File path where this error page should be saved to. Available variables are site and dimensions destination: '${"/var/www/default/mysite/errorpages/404.html"}' - # You can also configure path prefixes so some site areas have different error pages. Make sure to adjust the destination path accordingly. pathPrefixes: ['/some-special-path'] # The status codes this error page is generated for matchingStatusCodes: [404, 410] # Dimensions to use for this error page. Use empty array if no dimensions are configured dimensions: [] # Node identifier of documentNode to use for rendering source: '#f7c8d757-391a-4a85-bdb5-81df56d5e2c0' # File path where this error page should be saved to. Available variables are site and dimensions destination: '${"/var/www/default/mysite/errorpages/404-some-special-path.html"}' 'my-site-with-dimensions': - matchingStatusCodes: [500] # The first path segment that determines the dimensions. Use empty string if no dimensions are configured dimensionPathSegment: 'en_US' # Dimensions to use for this error page. Use empty array if no dimensions are configured dimensions: language: ['en_US', 'en'] source: '#550e8400-e29b-11d4-a716-446655440000' destination: '${"%FLOW_PATH_DATA%Persistent/ErrorPages/" + site + "-" + dimensions + "-500.html"}'
生成错误页面
要生成静态错误页面,请运行以下Flow命令
./flow errorpage:generate --verbose
这将循环所有错误页面并将它们下载到目标位置。根据配置的Neos页面内容更改的频率,您可能希望在部署期间或定期使用cronjob进行此操作。