Redirects of the old WordPress addresses as redirects.json (format of the CMS host)
The list is in config/redirectRules.ts (exact paths, from the old sitemap), written into dist/client by the build; check-artifact.sh requires it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
# Redirects of the old WordPress addresses (redirects.json)
|
||||
|
||||
The old site of andreaslop.nl was a WordPress site. Its addresses that are still indexed get a redirect (or "gone") on the new site. The site is the source of the list; the CMS host reads it and applies it the same on test and on production. The inventory of the old addresses is in `aidlc-docs/features/asf-production-iis/oude-urls.md`.
|
||||
|
||||
## Where it comes from
|
||||
|
||||
- The list is in code: `web/config/redirectRules.ts` (with tests in `redirectRules.test.ts`).
|
||||
- `pnpm build` ends with `web/config/writeRedirects.ts`, which writes `dist/client/redirects.json`, next to `index.html`. The deploy puts it in the prerendered-pages folder of the host (on test with the rest of `dist-test`, on production with the FTP upload). `deploy/check-artifact.sh` refuses a build without it.
|
||||
- Change the list only in `redirectRules.ts`; the file is never edited by hand.
|
||||
|
||||
## Format (agreed with the CMS session, design of 2026-11-18)
|
||||
|
||||
```json
|
||||
{
|
||||
"version": 1,
|
||||
"redirects": [
|
||||
{ "from": "/portfolio-item/decoration", "to": "/portfolio", "status": 301 },
|
||||
{ "from": "/feed", "status": 410 }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- `from`: a path with one leading slash, without query string, fragment or `..`. The first segment is never `admin`, `health` or `api`. The host matches it case insensitive and with or without a slash at the end, so a path is given once (both forms count as a duplicate).
|
||||
- `status`: `301`, `404` or `410`.
|
||||
- `to`: required for a 301 (a path of this site, or an absolute `https://` address; this list only uses paths) and not allowed for 404 and 410. It is never the same as `from`, and never itself a rule (no chains).
|
||||
- No patterns, no wildcards, no query-string rules (decision of Bryan: only plain paths). At most 5000 rules and 1 MB.
|
||||
- The host answers a 301 with `Location` and `Cache-Control: max-age=3600`, a 404 or 410 with the 404 page of the site as the body. A rule wins over an existing file. Only GET and HEAD. `redirects.json` itself is not served.
|
||||
|
||||
## What is in the list
|
||||
|
||||
| Old address | Answer |
|
||||
| ---------------------------------------------------------------------------------------- | --------------------- |
|
||||
| `/sitemap_index.xml`, `/wp-sitemap.xml` and the five old sub-sitemaps | 301 to `/sitemap.xml` |
|
||||
| `/portfolio-item` and the 15 items of the old sitemap | 301 to `/portfolio` |
|
||||
| `/portfolio-tag/{homepage,portfolio-gallerij,simple}` | 301 to `/portfolio` |
|
||||
| `/testimonials-category/photo` | 301 to `/` |
|
||||
| `/masonry-gallery-category/test-masonry-gallery` (theme demo), `/feed`, `/comments/feed` | 410 |
|
||||
|
||||
Not in the list on purpose:
|
||||
|
||||
- The real pages (`/over-mij/`, `/portfolio/`, `/soorten-fotoshoots/`, `/contact/`): the host redirects the slash, case and `.html` variants canonically (`web/config/canonicalUrls.ts`); the slugs are the same as on the new site.
|
||||
- Query-string addresses (`/?page_id=17`, `/?s=...`): decision of Bryan.
|
||||
- Addresses that are a 404 anyway: `/wp-admin`, `/wp-login.php`, `/xmlrpc.php`, `/wp-json`, `/wp-content`, `/category`, `/tag`, `/author`. A path without a rule gives the 404 page already.
|
||||
|
||||
## Open
|
||||
|
||||
- Whether to check Google Search Console and external links (Instagram, Google Business Profile) for other old addresses before the old site is switched off; if there are any, add them to `redirectRules.ts`.
|
||||
- After the host reads the file (CMS repo, small PR of SMC): add a check to `deploy/verify-deployment.sh --cms` that `/portfolio-item/decoration/` gives a 301 to `/portfolio`.
|
||||
Reference in New Issue
Block a user