检查重定向路径

七个经过测试的本地HTTP示例,并非扫描你的网站。来源链接与重定向响应分开呈现,不查询搜索引擎或外链索引。

计数覆盖来源页之后显示的GET请求。六次上限属于这个本地教学客户端,不是Googlebot的限制。终点响应也可能是错误,200并不能证明内容相关。

R01 · 迁移页面没有对应规则

预期结果
旧指南有合适替代页/guide,但旧网址目前返回404。
建议操作
添加一次永久跳转到声明的替代页。
验收条件
相同旧网址返回301,随后/guide以200提供预期指南。

来源页的链接 · 未改变

GET /publisher/r1
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Local source</title></head><body><h1>Source page</h1><a href="/r1/old-guide">Reference</a></body></html>

修复前

来源页之后的请求数: 1 · 重定向响应数: 0

GET /r1/old-guide
HTTP 404
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Unavailable</title></head><body><h1>Not available</h1></body></html>

已到达终点响应

修复后

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r1/old-guide
HTTP 301
Location: /guide
Cache-Control: no-store

GET /guide
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Replacement guide</title></head><body><h1>Replacement guide</h1><p>Equivalent guide content for the declared mapping.</p></body></html>

已到达终点响应

R02 · 能到达但多绕一步的链条

预期结果
指南通过/middle到达,多出的这一步可以省去。
建议操作
旧地址直接指向/guide,同时保留仍有用途的中间地址规则。
验收条件
请求从三次变成两次,最终指南及来源链接不变。

来源页的链接 · 未改变

GET /publisher/r2
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Local source</title></head><body><h1>Source page</h1><a href="/r2/old-guide">Reference</a></body></html>

修复前

来源页之后的请求数: 3 · 重定向响应数: 2

GET /r2/old-guide
HTTP 301
Location: /middle
Cache-Control: no-store

GET /middle
HTTP 301
Location: /guide
Cache-Control: no-store

GET /guide
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Replacement guide</title></head><body><h1>Replacement guide</h1><p>Equivalent guide content for the declared mapping.</p></body></html>

已到达终点响应

修复后

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r2/old-guide
HTTP 301
Location: /guide
Cache-Control: no-store

GET /guide
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Replacement guide</title></head><body><h1>Replacement guide</h1><p>Equivalent guide content for the declared mapping.</p></body></html>

已到达终点响应

R03 · 两个网址形成循环

预期结果
旧地址与/r3/loop互相跳转,无法到达最终文档。
建议操作
将入口规则改为直接对应/guide。
验收条件
不再因重复路径停止,观察到的响应是301和200。

来源页的链接 · 未改变

GET /publisher/r3
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Local source</title></head><body><h1>Source page</h1><a href="/r3/old-guide">Reference</a></body></html>

修复前

来源页之后的请求数: 2 · 重定向响应数: 2

GET /r3/old-guide
HTTP 301
Location: /r3/loop
Cache-Control: no-store

GET /r3/loop
HTTP 301
Location: /r3/old-guide
Cache-Control: no-store

网址重复:在再次请求前停止 · /r3/old-guide

修复后

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r3/old-guide
HTTP 301
Location: /guide
Cache-Control: no-store

GET /guide
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Replacement guide</title></head><body><h1>Replacement guide</h1><p>Equivalent guide content for the declared mapping.</p></body></html>

已到达终点响应

R04 · 首页成功响应,但内容不合适

预期结果
读者期待指南,而/home只有一般导航。两个阶段都以200结束。
建议操作
指向相应的/guide,而不是任意成功页面。
验收条件
同时核对最终路径和正文。这不是已观察到的Google软404分类。

来源页的链接 · 未改变

GET /publisher/r4
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Local source</title></head><body><h1>Source page</h1><a href="/r4/old-guide">Reference</a></body></html>

修复前

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r4/old-guide
HTTP 301
Location: /home
Cache-Control: no-store

GET /home
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Home</title></head><body><h1>Home</h1><p>General navigation, no replacement guide.</p></body></html>

已到达终点响应

修复后

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r4/old-guide
HTTP 301
Location: /guide
Cache-Control: no-store

GET /guide
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Replacement guide</title></head><body><h1>Replacement guide</h1><p>Equivalent guide content for the declared mapping.</p></body></html>

已到达终点响应

R05 · 内容删除且没有合适替代

预期结果
内容永久移除,/home不能满足原用途。
建议操作
在这个明确条件下返回410,并清理旧内部引用。
验收条件
旧地址返回410及不可用说明,不虚构替代内容或排名恢复。

来源页的链接 · 未改变

GET /publisher/r5
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Local source</title></head><body><h1>Source page</h1><a href="/r5/old-guide">Reference</a></body></html>

修复前

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r5/old-guide
HTTP 301
Location: /home
Cache-Control: no-store

GET /home
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Home</title></head><body><h1>Home</h1><p>General navigation, no replacement guide.</p></body></html>

已到达终点响应

修复后

来源页之后的请求数: 1 · 重定向响应数: 0

GET /r5/old-guide
HTTP 410
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Unavailable</title></head><body><h1>Not available</h1></body></html>

已到达终点响应

R06 · 临时迁移被声明成永久

预期结果
原服务会恢复,/holding只是临时通知。
建议操作
本GET示例使用302,并记录恢复原服务的计划。
验收条件
仍到达同一通知,但经由302而非301。旧缓存与搜索处理需要另外核对。

来源页的链接 · 未改变

GET /publisher/r6
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Local source</title></head><body><h1>Source page</h1><a href="/r6/old-guide">Reference</a></body></html>

修复前

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r6/old-guide
HTTP 301
Location: /holding
Cache-Control: no-store

GET /holding
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Temporary notice</title></head><body><h1>Temporary notice</h1><p>The original service is expected to return.</p></body></html>

已到达终点响应

修复后

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r6/old-guide
HTTP 302
Location: /holding
Cache-Control: no-store

GET /holding
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Temporary notice</title></head><body><h1>Temporary notice</h1><p>The original service is expected to return.</p></body></html>

已到达终点响应

R07 · 正确的永久映射保持不变

预期结果
旧指南已经通过一次301到达相应替代内容。
建议操作
保留工作正常的规则作为对照。
验收条件
前后证据完全一致,不制造多余修复或排名改善。

来源页的链接 · 未改变

GET /publisher/r7
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Local source</title></head><body><h1>Source page</h1><a href="/r7/old-guide">Reference</a></body></html>

修复前

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r7/old-guide
HTTP 301
Location: /guide
Cache-Control: no-store

GET /guide
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Replacement guide</title></head><body><h1>Replacement guide</h1><p>Equivalent guide content for the declared mapping.</p></body></html>

已到达终点响应

修复后

来源页之后的请求数: 2 · 重定向响应数: 1

GET /r7/old-guide
HTTP 301
Location: /guide
Cache-Control: no-store

GET /guide
HTTP 200
Content-Type: text/html; charset=utf-8
Cache-Control: no-store

<!doctype html><html lang="en"><head><title>Replacement guide</title></head><body><h1>Replacement guide</h1><p>Equivalent guide content for the declared mapping.</p></body></html>

已到达终点响应

运行案例

检查重定向路径

七个经过测试的本地HTTP示例,并非扫描你的网站。来源链接与重定向响应分开呈现,不查询搜索引擎或外链索引。

需要Python 3.10或更新版本。将ZIP解压到本地目录。验证命令会启动临时回环服务器,测试所有案例,输出JSON后停止,不访问外部网站。

python3 redirect_lab.py --verify

用Ctrl+C停止服务器,再用 --phase after 启动,即可在修正配置下检查相同网址。如果8766已占用,请选另一个本地端口。

python3 redirect_lab.py --phase before --port 8766

python3 redirect_lab.py --phase after --port 8766

http://127.0.0.1:8766/publisher/r1

http://127.0.0.1:8766/r1/old-guide

http://127.0.0.1:8766/publisher/r2

http://127.0.0.1:8766/r2/old-guide

http://127.0.0.1:8766/publisher/r3

http://127.0.0.1:8766/r3/old-guide

http://127.0.0.1:8766/publisher/r4

http://127.0.0.1:8766/r4/old-guide

http://127.0.0.1:8766/publisher/r5

http://127.0.0.1:8766/r5/old-guide

http://127.0.0.1:8766/publisher/r6

http://127.0.0.1:8766/r6/old-guide

http://127.0.0.1:8766/publisher/r7

http://127.0.0.1:8766/r7/old-guide

计数覆盖来源页之后显示的GET请求。六次上限属于这个本地教学客户端,不是Googlebot的限制。终点响应也可能是错误,200并不能证明内容相关。

命令和路径是技术标识符;报告正文已翻译。

未测量收录、规范网址选择、流量或排名,也不计算传递权重的百分比。

未测量收录、规范网址选择、流量或排名,也不计算传递权重的百分比。