NeovaNền tảng SEO chuyên sâu

Link trỏ tới localhost hoặc địa chỉ loopback

Trong Neova Chạy ngay từ lần crawl: không cần thiết lập gì.

Quy tắc được rà soát lần cuối ngày 17 tháng 10 năm 2026 · Hướng dẫn cập nhật ngày 1 tháng 7 năm 2026

Các địa chỉ này trỏ tới chính thiết bị mở link, nên link bị lỗi với khách truy cập và crawler.

Bạn có thể làm gì

Thay link bằng URL đang hoạt động.

Neova tìm ra bằng cách nào

Neova đọc HTML của mọi trang nó crawl và tìm điều này.

Vì sao Neova đánh dấu

  • localhost và địa chỉ loopback trỏ đến chính thiết bị mở link, nên link hỏng với khách truy cập và crawler.
  • Nó thường nghĩa là link được sao chép từ môi trường development.
  • Cùng link đó có thể để lộ chi tiết môi trường local cho bất kỳ ai đọc code.

Nguồn

Ticket nó tạo ra

Phần này tạm thời còn bằng tiếng Anh.

LI-009 · Link Points to Localhost or a Loopback Address

How to Check the Fix: 1. Run the check again in Neova
2. Spot-check sample URLs across affected templates
3. Record the re-check date and period label next to the baseline

Neova writes this ticket for every affected page group and sends it to Jira, Linear, Asana and the rest, after you approve it.

Hướng dẫn đầy đủ

Phần này tạm thời còn bằng tiếng Anh.

TL;DR: A link to localhost (localhost, 127.0.0.1, or ::1) is a development URL that leaked into your live site. It points at the visitor's own machine, not yours, so it is broken for everyone. It means your dev environment bled into production, and you should fix it and find out how it got there.
Type
Broken link
Severity
High if in prod
Root cause
Dev config leak
Best tool
Screaming Frog
Fix
Rewrite to live domain

This one is embarrassing when it goes live, because it screams "we tested this on a laptop and forgot to swap the URLs." A link to localhost is a hyperlink, image source, script, or canonical that points at http://localhost, http://127.0.0.1, or http://[::1]. Those addresses always mean "this same machine." On your dev box they resolve to your local server. On a real visitor's browser they resolve to the visitor's own machine, where nothing is listening, so the link is dead for every single person who is not you.

What "Localhost" Actually Points To

Localhost is a reserved hostname that loops back to the device making the request. It resolves to the loopback address, 127.0.0.1 in IPv4 or ::1 in IPv6. Nothing about it is tied to your server. When your browser requests http://localhost:3000 during development, it is talking to a server running on your own laptop. Ship that exact URL to production and every visitor's browser tries to reach a server on their laptop, which does not exist. Best case they get a connection refused. If they happen to be running something on that port, they might see their own unrelated app, which is worse and confusing.

Nobody types a localhost link on purpose into live content. They leak in through automation and config that was never switched over:

  • Hardcoded base URLs. A developer wrote http://localhost:3000/api or an image path against localhost and it never got parameterized for the environment.
  • Database dumps copied from dev. This is the classic in WordPress. Content and the site URL get written with localhost, then the database is imported to production without a search and replace.
  • CMS migrations. Moving a site between environments without updating the stored home and site URLs leaves localhost baked into links, canonicals, and asset paths.
  • Absolute links in a headless or static build. A build ran with a dev environment variable, so the generated HTML has localhost URLs frozen into it.
  • Copy-paste from local testing. Someone grabbed a URL from their browser while testing locally and pasted it into a post or a template.

Your live site Serves a link to http://localhost:3000 Visitor's browser "localhost" means THIS device Connection refused Dead link The link never reaches your server. It bounces to whatever is on the visitor's own port.

Why It Matters for SEO and Users

The type of element that holds the localhost URL decides how bad it is:

Where the Localhost URL Sits Impact
<a href> navigation link Dead click for every user. Wastes crawl budget on an unreachable target and signals a neglected page.
<link rel="canonical"> Serious. You are telling Google the canonical version of this page lives on localhost, which it cannot fetch. Can wreck indexing.
<img src> Broken image on the live page. Looks unfinished and hurts trust.
<script> or <link> asset Feature or stylesheet fails to load. Can break layout or functionality entirely.
Sitemap or hreflang Feeds Google unreachable URLs, polluting your index signals.

Beyond the direct breakage, localhost links are a canary. If one slipped through, your deploy process is not enforcing environment separation, and there are probably other dev artifacts riding along: debug flags, test data, staging URLs. Fixing the link is the easy part. Fixing the pipeline that let it out is the real job.

How to Detect Them

  • Screaming Frog: crawl the live site, then use the search or a custom filter for localhost and 127.0.0.1 across hrefs, images, canonicals, and scripts. This is the fastest full-site sweep.
  • Sitebulb: flags broken and non-resolving internal links and will surface localhost targets in its link reports.
  • Search Console: the Pages report shows crawl errors, and URL Inspection reveals a canonical pointing at localhost.
  • Grep the source or database: for a static build, grep -r "localhost" ./dist. For WordPress, search the database for localhost and 127.0.0.1 before you go hunting page by page.
  • curl: curl -s https://yoursite.com/page | grep -i localhost confirms whether a specific rendered page leaks one.

How to Fix It

  1. Find every instance with a crawl and a database or source search. Do not fix one and assume it is the only one.
  2. Rewrite the URLs to your live domain. For WordPress use a safe search-and-replace tool like WP-CLI wp search-replace or the Better Search Replace plugin, which handles serialized data correctly. Do not run raw SQL find-and-replace on serialized values, it corrupts them.
  3. Prefer relative or protocol-agnostic paths for internal assets where it makes sense, so the environment cannot bleed into the URL again.
  4. Fix the canonical and sitemap first if those are affected, since they carry the heaviest SEO consequence.
  5. Fix the pipeline. Parameterize base URLs by environment variable, add a pre-deploy check that greps the build for localhost and fails the deploy if it finds any, and run a search-replace step on every database import.
  6. Recrawl to confirm zero localhost references remain, and resubmit affected pages in Search Console.
DO
  • Parameterize base URLs per environment
  • Add a pre-deploy grep that blocks localhost from shipping
  • Run a safe search-replace on every database import
  • Fix affected canonicals and sitemaps first
  • Recrawl to confirm zero references remain
DON'T
  • Hardcode http://localhost:3000 into content or templates
  • Import a dev database without a search-replace step
  • Run raw SQL replace on serialized WordPress data
  • Fix one link and assume the rest are clean
  • Ignore a localhost canonical, it can break indexing

What Good Looks Like

A clean crawl of the live site returns zero references to localhost, 127.0.0.1, or ::1 in any href, image, script, canonical, sitemap, or hreflang. Base URLs are set by environment, database imports run through a proper search-replace, and your deploy pipeline fails loudly if a localhost string ever tries to ship again. The link this check flagged is gone, and so is the hole that let it through.

FAQ

Why Does a Localhost Link Work for Me but Nobody Else?
Because localhost means "this machine." On your computer it resolves to your local dev server, so the link works. On a visitor's computer it resolves to their machine, where nothing is running, so it fails. It only ever worked for you.
Is a Localhost Canonical Really That Bad?
Yes. A canonical tells Google the preferred URL for the page. If it points at localhost, you are naming an address Google cannot reach as the canonical, which can suppress indexing of the real page. Fix canonicals before anything else.
How Do I Stop This From Happening Again?
Set base URLs from environment variables instead of hardcoding them, add a pre-deploy check that greps the build for localhost and fails if it finds any, and always run a search-replace when importing a database between environments.
Can I Just Use Find-and-Replace in the Database?
Use a tool that understands serialized data, like WP-CLI search-replace or Better Search Replace on WordPress. A raw SQL replace will break serialized values by leaving byte-length prefixes wrong, corrupting settings and widgets.
Worried what else leaked from dev?

Localhost links are usually a sign your deploy pipeline is not enforcing environment separation. Our audit crawls your live site for dev artifacts, broken links, and canonical problems, then tells you exactly where they came from and how to fix them for good.

Tìm lỗi này trên trang của bạn

Neova chạy mục kiểm tra này và mọi mục khác trong mỗi lần crawl, rồi viết cách sửa thành ticket cho nhóm của bạn.

  • Ứng dụng máy tính cho Mac, Windows và Linux
  • Tất cả 696 mục kiểm tra, mỗi mục kèm nguồn
  • Search Console và Analytics 4, kết nối chỉ đọc
  • Ticket sang Jira, Linear và Asana

Tải Neova Gói Desktop Free, hoặc dùng thử Solo miễn phí 14 ngày, không cần thẻ.

Tất cả mục kiểm tra Link · Hướng dẫn · Thư viện mục kiểm tra

Do Neova Labs biên soạn · Quay lại Thư viện mục kiểm tra