typo3 - TYPO3 10 StaticRoute 返回 404 状态码
问题描述
我在 TYPO3 v10 中为我的 robots.txt 使用 staticText 路由(使用默认的 .htaccess 文件)。文本按预期交付,但标题中的 StatusCode 是 404。我不知道如何解决这个问题,因为 staticText 路由中没有设置 statusCode 的选项。
这是我的路线代码(如文档中所述:https ://docs.typo3.org/m/typo3/reference-coreapi/10.4/en-us/ApiOverview/SiteHandling/StaticRoutes.html ):
routes:
-
route: robots.txt
type: staticText
content: |
Sitemap: https://example.com/sitemap.xml
User-agent: *
Allow: /
Disallow: /forbidden/
解决方案
仔细查看文档。
在 YAML 文件中,缩进是关键。您必须缩进您的多行内容(以“站点地图:...”开头)。
routes:
-
route: robots.txt
type: staticText
content: |
Sitemap: https://example.com/sitemap.xml
User-agent: *
Allow: /
Disallow: /forbidden/
推荐阅读
- swift - 如何使用 AXObserverAddNotification?
- java - 使用模拟 SFTP 服务器进行 Sprint 集成流测试?
- firefox - 当 Allow-Credentials 设置为 true 时,为什么我不能在 Access-Control-Allow-Headers 上使用通配符 *?
- php - 尽管我在那里添加了数据,但为什么此时数组始终为空?
- javascript - 带有随机颜色生成器的剪贴板
- vaadin - Vaadin 14:带有图标、文本和图像的 Textfield 标签的工具提示
- python - Django:为自定义用户模型使用外键关系
- c# - Unity 如何在脚本 CS0246 中正确声明输入操作
- jenkins - 访问 jenkins url 时出现 HTTP ERROR 404 Not Found 错误
- testing - 使用 Ctrl+C 关闭 Netrlify 服务器后,React Server 继续在端口 3000 上运行