Addresses that do not exist answer 200 with the home page: /robots.txt, /favicon.ico and any path without a language
メンテナーはふだん 1 日以内に返信
評価
調査の方向性
Read system/core/HyphaRequest.php around lines 82 and 104-107, then system/core/pages.php around lines 250-254 and system/datatypes/index.php around lines 33-38. Start with tests/HyphaRequestTest.php and check the linked pull request #608 for the current proposed behavior. Done means the listed invalid paths and unused language index return 404, while root, index.php, and the <type>/<name> form keep their intended behavior.
索引モデルが issue の本文から書いたものです。
説明
Every address whose first segment is neither a language nor a system page answers 200 with the home page. Search engines, link checkers and monitoring therefore never see a 404 for a mistyped or removed address, and every such URL is indexed as one more copy of the home page (a "soft 404", duplicate content).
| Request | Answer on main |
|---|---|
/robots.txt |
200, text/html, the home page (crawlers read it as robots.txt; see also #523) |
/favicon.ico |
200, text/html, the home page |
/wp-login.php, /anything, /Over_ons |
200, the home page |
/foo/Over_ons |
200, the page nl/Over_ons (a second URL for every page) |
/index/fr (no French page exists) |
200, an empty page index |
/xx/yy/zz, /nl/Geen_pagina |
404 (correct) |
Cause. HyphaRequest::processRequest() (system/core/HyphaRequest.php:104-107) drops the first segment of a path without a language as a "page type" (the form <type>/<name> of tests/HyphaRequestTest.php, such as festival/festival). For /robots.txt the page name is then empty, and loadPage() (system/core/pages.php:250-254) shows the default page. The page index (system/datatypes/index.php:33-38) accepts every code of languages.json, also one that no page uses.
A related slip: HyphaRequest keeps a query that directly follows the root (/?utm_source=x) as a path segment, because strpos() returns 0 there and 0 && ... is false (HyphaRequest.php:82). Today that only works by accident (the segment is dropped as a "page type").
Evidence (PHP 8.2 container of docs/container, fictional test site with pages in nl and en):
$ curl -s -o /dev/null -w '%{http_code} %{content_type}\n' http://127.0.0.1:8172/robots.txt
200 text/html; charset=utf-8
$ curl -s http://127.0.0.1:8172/favicon.ico | grep -o '<div id="main">.\{0,40\}'
<div id="main"><p>Welkom op de proefsite van Eemstad.
$ curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:8172/index/fr
200
Suggested fix. Only the root (and index.php, which hypha.php mentions as the entry) without a language shows the default page; another path without a language and page name gives 404. The page index of a language that no page uses gives 404, like the index of an unknown code already does. Strip a query at position 0 as well. The <type>/<name> form keeps working; whether it should rather redirect (301) to <language>/<name> is a question for the maintainers, as is a redirect of the root to /<default language>/<home page> (canonical URLs are #521).
Found while checking multilingual sites for SEO. Tested in the PHP 8.2 and 8.5 containers of docs/container with a fictional test site: reproduces on main (d97ab7b), gone with the linked pull request, which is offered as a suggestion and a starting point.
🤖 Generated with Claude Code
- 主要言語
- JavaScript
- スター
- 5
- フォーク
- 9
- 平均マージ
- 19時間 10分
- マージ済み PR(30日)
- 12
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PlanBCode/hypha のほかの issue
-
Component: User interface Impact: Low Level: Easy Pagetype: Peer reviewed article Type: Bug Value: Visitors
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
Impact: Medium Level: Easy Type: Bug Value: Users
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
Impact: Low Level: Easy Pagetype: Festival Type: Bug Value: Coders
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
Impact: Medium Level: Easy Pagetype: Mailinglist Type: Bug Value: Users
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
メンテナーはふだん 1 日以内に返信
-
Impact: Low Level: Easy Type: Bug Value: Coders
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
PlanBCode/hypha#586 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
PlanBCode/hypha の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
メンテナーはふだん 1 日以内に返信
-
check:failed logos:add
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
iptv-org/database#38874 · コメント 1 件 ·
メンテナーはふだん 4 日以内に返信
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
githubnext/gh-aw-workshop#5193 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100