Skip to content
GitLab Next
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • G gitlab-pages
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 167
    • Issues 167
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.orgGitLab.org
  • gitlab-pages
  • Merge requests
  • !458

Add splat and placeholder support to _redirects

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Nathan Friend requested to merge nfriend-add-splat-redirects into master Apr 14, 2021
  • Overview 290
  • Commits 1
  • Pipelines 23
  • Changes 19

What does this MR do?

Adds support for Netlify-style splats (*) and :placeholders in _redirects.

This can be used to route all matches to a single, static path:

/foo/* /bar 200

or to a dynamic path using the placeholders:

/foo/*                 /bar/:splat                     200
/foo/:year/:month/:day /bar/blog/:year-:month-day.html 200

Why?

There are a lot of use cases for this feature, but the killer feature for this is to support single page applications (SPAs) that expect the main index.html page to be served for all requests. (See #23 (closed))

This can be accomplished with a configuration like this:

/* / 200

Documentation

This new functionality will be documented in gitlab!59803 (merged)

TODO

  • Added the Changelog (e.g. Changelog: feature) trailer to the commits that need to be included in the changelog
  • Added unit tests (if required)
  • Added acceptance tests (if required)
  • Documentation (if required) (will be added in gitlab!59803 (merged))
  • Code review guidelines
  • Go Style guidelines

Related to #500 (closed)

/_redirects sample with new validations

Screen_Shot_2021-05-03_at_4.18.07_pm

Edited Aug 12, 2021 by Nathan Friend
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: nfriend-add-splat-redirects