Fix a problem / DETAILED TASK GUIDE

Fix refresh on a nested route

If a route works after clicking but fails on refresh, the server may not know how to serve it directly. The fix depends on the framework and hosting mode; a blanket rewrite can hide genuine missing pages.

BY BUILDING APPS WITHOUT CODEUPDATED OCT 14, 2026AI-ASSISTED TASK

Before you start

  • The exact failing URL and hosting configuration.
  • Whether the app uses server rendering, static generation, or a client router.
  • An existing build and deployment preview.

How to do it

  1. Open the route directly and record its actual HTTP response.
  2. Inspect framework route definitions and the host output or rewrite configuration.
  3. Use a generated page, server route, or carefully scoped fallback appropriate to that architecture.
  4. Test the real route and a made-up route. The latter should still behave as a genuine 404.

Before & after

ILLUSTRATIVE EXAMPLE
GET /guides/start/ → 200
GET /not-a-real-page/ → 404

Existing pages work when opened directly or refreshed. Unknown pages do not silently become successful homepage responses.

MAKE IT YOURS

Use with an AI coding tool

1 Describe your change

Use your own words. You do not need a file name. The prompt asks the AI to preserve unrelated work.

We remember this choice on this device. Choosing a tool does not connect it to this website.

2 Copy your prompt

Read the complete prompt below, then copy it.

3 Paste into your AI coding tool

Open your website or app project in your AI coding tool. Paste this into its AI chat box and send it. The tool needs access to your project files to make changes.

A website address alone does not give an AI permission or access to edit it. This prompt goes into an AI chat, not a regular terminal window.

4 Check the result

Check direct load, refresh, client navigation, and real unknown-route 404 behavior.

Open your project preview and try the change. Review what changed before publishing. If it is wrong, use your tool’s undo or restore your saved project version.

If the result is not what you expected

Everything was redirected to the homepage

That hides missing routes and sends visitors to the wrong content.

The local dev server works

Production hosting can serve routes differently. Test the built output.

Undo the change

Restore only the changed route or host configuration, retaining any unrelated deployment settings.

References & testing

The examples above explain the expected behavior; they are not a claim that this prompt has been tested in every framework or AI model. Test the proposed change in your actual project before publishing.

Google: JavaScript SEO basics ↗ · Our review approach