Redirect Mapping for Hallucinated URLs

AI models hallucinate URLs to your domain—creating broken links that waste traffic. This tool analyzes your server logs and site structure to recommend strategic redirects. Input your 404s, run the script, and get implementation-ready redirect mappings with relevancy scores and priority rankings.

hallucinated URLs apps script

Step-by-Step Guide

Make a copy of the template to your own Google Drive before beginning.

You’ll need:

  • Server logs showing 404 visits (ideally from Screaming Frog with AI bot breakdowns)
  • A full Screaming Frog crawl of your site
  • An API key (setup instructions included in the template)
Get the Template
  • Add Your Server Logs

    Step 1

    Navigate to the Server Logs tab and paste your 404 data. This should include visits from AI bots (Claude, Gemini, ChatGPT, etc.).

    Don’t worry about filtering—paste everything. The script automatically focuses only on 404 status codes and ignores the rest.

  • Add Your Site Structure

    Step 2

    Go to the All URLs tab and paste your complete Screaming Frog crawl.

    Pro tip: If your Screaming Frog crawl includes vector embeddings, the tool will use semantic relevance matching for even better redirect suggestions.

  • Configure Your API Key

    Step 3

    Set up your API key following the instructions in the template. This powers the matching algorithm.

    Need help with API setup? Instructions are included in the sheet.

  • Run the Analysis

    Step 4

    Click “Analyse Hallucinated URLs” in the menu.

    The script will process your data and generate redirect recommendations.

  • Review Your Results

    Step 5

    You’ll get a new sheet with:

    • Hallucinated URL – The broken URL AI models are creating
    • Best Match URL – Your recommended redirect target
    • Relevancy Score – How confident the match is
    • Priority – Implementation priority ranking
    • Number of Events – How many times AI bots hit this 404
    • Intent – The likely user intent behind the hallucinated URL
    • Reasoning – Why this redirect was recommended
  • Implement

    Step 6

    Export the mappings and work with your dev team to implement the redirects. Prioritize by the Number of Events and Priority columns.

What's Next

Review the recommendations strategically before implementing. The tool provides smart suggestions, but you know your site best—adjust as needed.

Run this monthly to catch new hallucinations as AI models evolve and train on updated data. Set up 404 monitoring to feed fresh URLs directly into your next analysis.