ChatGPT links to 404 pages: find and fix AI-invented URLs
When ChatGPT links send visitors to 404 pages, find those hits with utm_source=chatgpt.com in GA4 and logs, sort them by cause and pick a redirect or a 404.
By Crawlito · 9 min read
In short
- Links clicked in ChatGPT often carry utm_source=chatgpt.com, so a 404 hit with that parameter most likely came from a ChatGPT link to a missing page.
- GA4 only records a 404 visit if your error page loads the Google tag, so give the 404 template a fixed page title and filter Page location for utm_source=chatgpt.com.
- Server logs catch what GA4 misses: requests with the ChatGPT tag, a chatgpt.com referrer, or the ChatGPT-User agent that end in status 404.
- Sort each dead URL into moved, mistyped or never existed before choosing a fix; only the first two usually have a real page to redirect to.
- Google says redirecting many old URLs to one irrelevant page such as the home page may be treated as a soft 404, so a plain 404 is the right answer when nothing matches.
On this page
When ChatGPT links to a page on your site that returns 404, you can find most such hits in your own data: links people click in ChatGPT often carry utm_source=chatgpt.com, so a 404 request with that parameter most likely started as a ChatGPT link that pointed at a missing page. Pull those URLs from GA4 and your server logs, sort them into pages that moved, URLs that are slightly wrong and URLs that never existed, then redirect the first two to the right live page and let the third return a real 404.
This post is about detection and triage. For why the response codes matter, it links to the posts that cover them in depth instead of repeating them.
How to tell a ChatGPT 404 from any other 404
Most sites get a steady stream of 404s from scanners, old bookmarks and typos. You want only the ones that came from ChatGPT, and there are three signals, each with a different source:
| Signal | Where you see it | Documented by |
|---|---|---|
utm_source=chatgpt.com in the requested URL | GA4 page location, server access logs | Observed on ChatGPT links, no current OpenAI page |
A referrer on chatgpt.com | GA4 page referrer and session source, logs | Browser behaviour, not guaranteed |
The ChatGPT-User user agent | Server or CDN logs only | OpenAI's crawler overview |
The tracking parameter is the strongest signal, with one caveat. OpenAI's publishers FAQ used to say ChatGPT adds utm_source=chatgpt.com to referral URLs, but at the time of writing that FAQ address redirects to an unrelated page, so treat the tag as an observed pattern that may not appear on every link. Because the parameter travels in the URL itself, it survives when the browser sends no referrer. It also stays on the link if someone copies it out of ChatGPT and shares it elsewhere, so a few of these hits may be second-hand clicks.
The ChatGPT-User agent is a different case. OpenAI says it is not used to crawl the web automatically: when a user asks ChatGPT or a custom GPT a question, ChatGPT may visit a web page with this agent, and it is also used for GPT Actions. A 404 to ChatGPT-User means ChatGPT tried to fetch a URL on your site while answering someone, and the URL did not exist. That is not a human click, but it often points at the same bad URLs.
OpenAI does not document how ChatGPT chooses or forms the URLs it links to, or how often those URLs are wrong. So treat the list you build as a record of what happened on your site, not as evidence about ChatGPT in general.
Find ChatGPT 404s in GA4
GA4 can only count a 404 visit if the error page loads your Google tag. Some themes and frameworks render the 404 template outside the layout that normal pages use, so check first: open a made-up URL on your site with Tag Assistant or your browser's network panel and confirm a page_view is sent.
Then make the 404 page easy to filter. Give it a fixed, unique title, for example Page not found | Example. GA4 records it in the Page title dimension, which Google's dimensions reference describes as the title you set on your site.
Build a free form exploration:
- Open Explore and start a Free form exploration.
- Import the dimensions Page location, Page referrer, Page title and Session source, and the metric Views.
- Put Page location in Rows and Views in Values.
- Add a filter: Page title exactly matches your 404 title.
- Add a second filter: Page location contains
utm_source=chatgpt.com.
Page location is the full URL of the page viewed, so it keeps the path that failed and the tracking parameter. Google's automatically collected events page lists page_location and page_referrer as parameters of every page_view on web streams, with limits of 1,000 and 420 characters.
Duplicate the tab and swap the second filter for Session source exactly matches chatgpt.com. Besides the direct landings, this view also catches visitors who arrived from ChatGPT on a working page and then followed a broken link further in. Those are your own broken internal links, and the fixes are in broken internal links. For a channel view of ChatGPT traffic as a whole, see tracking AI traffic in GA4.
Find ChatGPT 404s in server logs
Logs record every request whether or not analytics ran, including visitors who declined consent and the ChatGPT-User fetches GA4 never sees. With the "combined" log format (nginx's default for access_log, and a common choice on Apache), the request path is field 7 and the status is field 9:
# ChatGPT clicks that hit a 404, counted by path
grep 'utm_source=chatgpt.com' access.log \
| awk '$9 == 404 {print $7}' \
| sort | uniq -c | sort -rn | head -50
# 404s where the browser sent a chatgpt.com referrer
grep '"https://chatgpt.com' access.log \
| awk '$9 == 404 {print $7}' \
| sort | uniq -c | sort -rn
# ChatGPT-User fetches that hit a 404
grep 'ChatGPT-User' access.log \
| awk '$9 == 404 {print $7}' \
| sort | uniq -c | sort -rnAdjust the field numbers if your log format differs, and read rotated or compressed files with zgrep. Anyone can send a ChatGPT-User user agent, so verify the source IP against the ranges OpenAI publishes in https://openai.com/chatgpt-user.json before you treat those lines as real. If your site sits behind a CDN, the origin log may show the CDN's addresses rather than the client's, so check the CDN's own request logs for the client IP, path, status and user agent.
Combine the three lists into one sheet with the path, the hit count and the signal it came from. Strip the query string before you deduplicate so /pricing-plans?utm_source=chatgpt.com and /pricing-plans count as one URL.
Sort each URL into moved, mistyped or never existed
The fix depends on why the URL is dead, so classify each one before changing anything. Three groups cover nearly every case:
| Group | How to recognise it | How to confirm |
|---|---|---|
| Moved | The URL once worked: an old slug, an earlier site structure, a removed section | Old sitemaps, CMS redirect history, past 200 responses for the path in old logs, the Wayback Machine |
| Mistyped | Close to a live URL: wrong case, missing or extra trailing slash, truncated slug, stray characters such as a trailing ) or . | Compare against your sitemap; the live page is one small edit away |
| Never existed | Follows your URL pattern but no page was ever published there, for example /blog/pricing-for-agencies on a site that has no such post | No trace in sitemaps, CMS or old logs |
A quick way to separate the first two from the third is to check your own history. If your logs or the CMS show a 200 for the path in the past, it moved. If the nearest live URL differs by a character or two, it is mistyped. If neither is true, it never existed.
The "never existed" group is the one people mean by AI-invented URLs. The path looks plausible because it follows the shape of your real URLs, but nothing was ever there. Do not assume every URL in this group was invented by ChatGPT, though: some will come from other sites that link to you, scanners, or people editing URLs by hand. The tracking parameter tells you the click came through ChatGPT, not where the URL itself came from.
Redirect or keep the 404: a short decision table
Once each URL has a group, the response follows from one question: is there a live page that serves the same purpose?
| Group | Real equivalent exists? | Response |
|---|---|---|
| Moved | Yes | 301 to the new URL |
| Moved | No, the content was removed | 404 or 410 |
| Mistyped | Yes, by definition | 301 to the correct URL |
| Never existed | A live page covers that exact topic | 301 to that page |
| Never existed | Nothing matches | Keep the 404 |
Google's redirects documentation recommends a permanent server-side redirect whenever possible, because it has the highest chance of being interpreted correctly by Google, and its crawling errors page says Google treats a 301 as a strong signal that the target should be processed. The choice between the redirect codes is covered in 301, 302, 307 and 308 redirects, and the 404 or 410 choice for removed pages in 410 vs 404 for deleted pages.
The tempting shortcut is to redirect every dead ChatGPT URL to the home page. Google's site move guidance warns against redirecting many old URLs to one irrelevant destination such as the home page, because it can confuse users and might be treated as a soft 404. If a rule like that is already in place, redirecting 404s to the homepage shows how to find and undo it.
Keep the tracking parameter through the redirect
When you add a redirect for a URL that ChatGPT sends people to, make sure the query string survives, or GA4 loses the utm_source on the next page. In nginx, append it explicitly with $is_args (a ? when the request has arguments, otherwise empty) and $args, as documented:
location = /pricing-plans {
return 301 /pricing$is_args$args;
}Test the result rather than trusting the config:
curl -sI 'https://example.com/pricing-plans?utm_source=chatgpt.com' | grep -i -E '^(HTTP|location)'nginx turns the local path into a full URL, so the location header should end in /pricing?utm_source=chatgpt.com, and the final URL should answer 200.
Make the 404 page earn its keep
For the URLs that stay 404, the page itself is what the visitor sees. Keep the 404 status, and give the page a short message, a search box and links to your main sections, so someone who clicked from ChatGPT can still find what they wanted. A page that says "not found" but returns 200 is a soft 404, which soft 404 pages and AI crawlers explains.
Keep the list current
Bad URLs keep arriving as long as people ask about your site, so make this a small recurring task rather than a one-off clean-up:
- Once a month, rerun the GA4 exploration and the log commands for the past month.
- Add new paths to the sheet with their group and the response you chose.
- Check that last month's redirects still answer 301 to a live 200 page.
- Watch for patterns. If several invented URLs ask for the same thing, such as a pricing page for a segment or a guide you never wrote, that is a signal about what people expect to find on your site. Whether to publish such a page is an editorial decision, not a technical fix.
Frequently asked questions
Why does ChatGPT link to pages that do not exist on my site?
OpenAI does not document how ChatGPT forms the URLs it links to. In your own data, dead URLs usually turn out to be old addresses, near misses of real ones, or plausible paths that were never published, and each group has a different fix.
Can I stop ChatGPT from linking to wrong URLs?
There is no documented setting for that. What you control is what those URLs return: a redirect to the right page where one exists, and a real 404 where none does.
Should I redirect every ChatGPT 404 to my home page?
No. Google warns that redirecting many old URLs to one irrelevant page such as the home page might be treated as a soft 404. Redirect only to a page that serves the same purpose.
Why do ChatGPT 404s show in my logs but not in GA4?
GA4 only records a visit when its tag runs, so a 404 template without the tag, declined consent, or a ChatGPT-User fetch will not appear. Server logs record the request either way.
Does a redirect lose the utm_source=chatgpt.com parameter?
It can. Some redirect rules drop the query string, so test the redirect with curl -I and confirm the location header still carries the parameter.
Check the pages you redirect to
A redirect only helps if the target page works for both visitors and the crawlers that read it. Run the free check on the destination pages you picked to confirm they return 200 and that AI crawlers can read their content.
Filed under Strategy and audits. Topics: chatgpt, http-status, analytics, redirects, troubleshooting