Repository navigation
feat: redirects for the front end (0.5) - #12
Merged
Merged
Conversation
- Redirect and RedirectRules: validated rules (path, destination, status, pattern, loop), exact before pattern, first source wins - OptionRedirectStore (managed with wp headless redirect add|remove|list|test) and OldSlugRedirects (the earlier addresses WordPress keeps for renamed posts, each to the current one) - GET /wp-json/headless/v1/redirects and /redirects/resolve?path= (a 200 either way, cacheable)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Second slice of 0.5. A front end has no memory of a renamed or moved page: the redirects now come from WordPress.
wp headless redirect add|remove|list|test, exact paths or patterns (anchored on the whole path, groups in the destination), 410 for a page that is gone. A rule is validated when made: path, destination (a path or an absolute http(s) URL, never//hostorjavascript:), status, a pattern that compiles, no loop._wp_old_slugWordPress keeps for renamed posts, each to the current address (published posts only, kept five minutes, dropped on save).GET /headless/v1/redirectsand/redirects/resolve?path=/old/(a 200 withnullwhen nowhere, so a CDN keeps it).