Redirecting a URL whose text portion has changed depends on how the site identifies content and whether you are replacing the page’s URL: If the URL contains a unique ID, retrieve the content by ID, then check the text portion (slug) and use a 301 redirect to the correct URL if it does not match. When replacing a page’s URL, map the old URL to the new one and configure a redirect.
With a unique ID: find the content, then correct the slug
Take /news/564/seo-improvements.html as an example. If news and 564 are enough to identify the article, the site does not need to rely on the final text portion. A discussion on Webmasters Stack Exchange suggests checking the slug after finding the article; another answer explicitly recommends using a 301 redirect to the correct URL if it does not match.
- Extract the content type and ID from the requested URL, such as news and 564.
- Use the ID to look up the database record and the current correct slug.
- Compare the slug in the request, and redirect to the correct URL only if it differs.
For example, if the article ID is still 564 but the requested URL is /news/564/changed-text.html, the site can redirect to the original, correct path. This does not involve guessing what the text means; it uses the ID to retrieve the same content. Even two articles with identical titles can be distinguished by their different IDs. However, a respondent in the original discussion also expressed reservations about endorsing this strategy. Being technically possible does not mean it is appropriate for every website.
When replacing URLs: map each old URL to its replacement
If you are changing the URLs of just three pages, first list the three old paths and their corresponding new URLs, then configure a 301 redirect for each. This approach does not require URLs to contain IDs. What matters is that each old URL points to the corresponding content, rather than an arbitrary page.
The implementation depends on your CMS and server environment. If you use Linux/Apache and manage redirects through .htaccess, a forum answer provides this example directive:
Redirect 301 /old-url https://yourdomain.com/new-url
Replace the old path and new URL in the example with your actual values; for three pages, add one entry per page. Back up .htaccess before making changes. If your site uses WordPress, check the existing .htaccess configuration to determine where to place the directives. A single forum answer should not be treated as a rule that applies to every site.
Afterward, check redirect destinations and unnecessary hops
- Confirm that old URLs redirect to the corresponding content, and avoid loops in which old and new URLs redirect back to each other.
- Update internal links to point directly to the correct URLs rather than continuing to route through the old ones.
- Minimize redirect chains; web.dev notes that each redirect requires an additional HTTP request.
- If an old URL has no corresponding content, the site migration discussion recommends providing a useful 404 page with alternative ways to find content, rather than redirecting it somewhere just to have a destination.
Before setting up redirects, distinguish between an incorrect slug attached to the same ID and old links left behind after a page’s URL changes. Then choose the approach that fits.
URL redirects: perspectives from across the web
When handling many old URLs, do you need a separate redirect directive for each one?
Not necessarily. If there is a consistent pattern between the old and new URLs, rules can reduce the number of redirects in the configuration file. If no usable pattern exists, one discussion suggests rewriting HTML requests to a PHP script that reads mapping data from a file or database. Although this can make .htaccess smaller, the mappings still have to be created manually, and whether the approach is suitable also depends on the website’s environment.
Besides page URLs, which old URLs should you inventory when migrating a website?
The inventory should also include alternative URLs for the same page, as well as media assets that may be embedded on external sites, such as image buttons, banners, or videos. A site migration discussion recommends mapping old assets to their new locations and configuring redirects accordingly. This helps avoid handling only the main pages while overlooking resources that are still being referenced.
Do you still need to account for old links if you only change a page’s file extension?
Yes. Changing a page’s file extension on a live website also changes its URL. If the old URL is not handled, existing links and bookmarks may break, and links from search results may lead to 404 errors during the transition, potentially affecting search performance. For pages that still have corresponding content, plan redirects from the old URLs to the new ones rather than leaving broken links.
References
- General HTML performance considerationsweb.dev — Source used in the article above.
- Moving large website to new CMS - URL changeswebmasters.stackexchange.com — Discusses: Besides page URLs, which old URLs should you inventory when migrating a website?
- Moving large website to new CMS - URL changeswebmasters.stackexchange.com — Source used in the article above.
- SEO - which URL's are the best?webmasters.stackexchange.com — Source used in the article above.
- Help with 301 redirectwww.warriorforum.com — Source used in the article above.
- SEO - Changing file extensionwebmasters.stackexchange.com — Discusses: Do you still need to account for old links if you only change a page’s file extension?
- SEO - Changing file extensionwebmasters.stackexchange.com — Discusses: Do you still need to account for old links if you only change a page’s file extension?
- Can we do bulk Permanent 301 redirection in a website*?www.warriorforum.com — Source used in the article above.
- Is there an easier way to implement 301 redirects when converting a site to WordPresswebmasters.stackexchange.com — Discusses: When handling many old URLs, do you need a separate redirect directive for each one?
- SEO - which URL's are the best?webmasters.stackexchange.com — Source used in the article above.

