| # | 文件(相对 /htdocs/V400/) | 动作 | 说明 |
|---|---|---|---|
| 1 | _https.php | 新建 | PHP 层 http→https 兜底;仅 GET/HEAD 301,POST 不跳;CLI/已是 https 自动跳过 |
| 2 | includes/core.php | 改 1 行 | ROOT_DIR 之后插入 require_once ROOT_DIR . '/_https.php';,覆盖全部公开页 |
| 3 | admin/_guard.php | 新建 | 后台 IP 白名单:127.0.0.1、::1、112.12.48.0/24;未授权返回 403;顶部有 bypass 开关 |
| 4 | admin/login.php | 改 1 行 | <?php 之后、session_start() 之前 require_once __DIR__.'/_guard.php'; |
| 5 | admin/common.php | 改 1 行 | <?php 之后加 _guard.php,覆盖 49 个后台业务页 |
| 6 | 404.php | 改 2 处 | 加 http_response_code(404);主文案改"页面走丢了";新增三按钮:返回首页/产品中心/新闻列表 |
| 7 | news/detail.php | 改 1 行 | else 分支($news 为空)开头加 http_response_code(404) |
| 8-15 | news/n20261016_2318*.html ×8 | 覆盖 | 静态归档提示页(noindex + 3s refresh + canonical 指向 news.php) |
| 16 | sitemap.xml | 改 | 删除上述 8 个坏 html 的 <loc>(279 → 271) |
FTP 目录:/htdocs/V400/_backup_20261022/
├── 404.php (1786 bytes, 原文件) ├── sitemap.xml (52555 bytes, 原文件) ├── admin/login.php (5394 bytes) ├── admin/common.php (18491 bytes) ├── includes/core.php (16549 bytes) ├── news/detail.php (3610 bytes) └── news/ (8 个原坏文件:3×0字节 + 5×725字节)
回滚:FTP 把对应文件从 _backup_20261022/ 按相对路径 STOR 回原位置即可。
| 验证项 | URL | 期望 | 实际 | 通过 |
|---|---|---|---|---|
| https 首页 | https://www.hedalong.com/V400/ | 200 | 200 (160ms) | ✅ |
| http 首页 301 | http://www.hedalong.com/V400/ | 301→https | 301, Location: https://www.hedalong.com/V400/ | ✅ |
| 不存在新闻详情 | .../news/detail.php?id=notexist | 404 | 404 (154ms) | ✅ |
| 不存在 php | .../nonexist.php | nginx 黑 404 | 404 (123ms) | ✅(记录项) |
| 归档页 | .../news/n20261016_2318202591.html | 200 + 已归档 + noindex | 200, 含"已归档"+noindex | ✅ |
| admin 登录页(非白名单 IP) | .../admin/login.php | 403 未授权 | 403, 含"未授权访问" | ✅ |
| 页面 | 状态码 | TTFB |
|---|---|---|
| home | 200 | 147.9 ms |
| about | 301 | 120.8 ms |
| news.php | 200 | 141.1 ms |
| news detail 1 | 301 | 64.7 ms |
| news detail 2 | 301 | 53.5 ms |
| news detail 3 | 301 | 57.0 ms |
| news detail existing | 404 | 157.2 ms |
| guobiao | 200 | 139.0 ms |
| oubiao | 200 | 158.5 ms |
| contact | 200 | 157.2 ms |
| sheji | 200 | 153.3 ms |
about、news detail 1/2/3 返回 301 是因为 sitemap.xml 里的 <loc> 仍是 http:// 前缀,由 nginx 做全站 http→https 301,属预期行为,非本次改动引入。
| 状态码 | 改前(279 URL) | 改后(271 URL,已剔除 8 个坏 html) | 变化 |
|---|---|---|---|
| 200 | 274 | 264 | sitemap 删 8 条,分母变小;200 数无回归 |
| 301 | 0 | 0 | 0 |
| 404 | 5 | 7 | +2(均为 detail.php 真 404 修复带来的预期变化) |
改后 404 清单(共 7 条):
112.12.48.0/24 段内(或回环)。如果人在外面:
/htdocs/V400/admin/_guard.php$GLOBALS['ADMIN_GUARD_BYPASS'] = false; 临时改成 true,保存上传如发现任何页面异常,FTP 登录 → 进入 /htdocs/V400/_backup_20261022/ → 按原相对路径把文件 STOR 回 /htdocs/V400/ 对应位置即可。