Commit 987adb33 authored by Michal Wasilewski's avatar Michal Wasilewski

docs, fix regex paths

parent 4caee58b
Pipeline #54081961 passed with stages
in 37 minutes and 11 seconds
......@@ -72,8 +72,8 @@
- sources: /handbook/engineering/career-development/junior-developers/
target: /handbook/engineering/career-development/junior-engineers/
comp_op: ^~
- sources: ^/roles/(.*)
target: /job-families/$1
- sources: /roles/
target: /job-families/
comp_op: '~'
- sources: /job-families/engineering/developer/
target: /job-families/engineering/backend-engineer/
......@@ -387,23 +387,23 @@
- sources: /handbook/product/pricing
target: /handbook/ceo/pricing/
comp_op: ^~
- sources: ^/integrations(.*)
target: /partners/integrate$1
- sources: /integrations
target: /partners/integrate
comp_op: '~'
- sources: ^/company/culture/remote-only(.*)
target: /company/culture/all-remote$1
- sources: /company/culture/remote-only
target: /company/culture/all-remote
comp_op: '~'
- sources: ^/comparison(.*)
target: /devops-tools$1
- sources: /comparison
target: /devops-tools
comp_op: '~'
- sources: ^/applications(.*)
target: /partners$1
- sources: /applications
target: /partners
comp_op: '~'
- sources: /researchpanel/
target: /community/researchpanel/
comp_op: '='
- sources: ^/serverless(.*)
target: /product/serverless$1
- sources: /serverless
target: /product/serverless
comp_op: '~'
- sources:
- /about/
......
## Overview ##
With the evolution of `about.gitlab.com`, paths are becoming obsolete or are being moved to other locations. For some of those paths we want to configure 301 HTTP redirects. 301 redirects are managed using a yml config file which can be found in this repo under the following path: `data/redirects.yml`. This yml file is read by an automated script which configures `about.gitlab.com`.
here's a snippet from the yml file:
```
- sources: /pdfs/resources/gitlab-scaled-ci-cd-whitepaper.pdf
target: /resources/whitepaper-scaled-ci-cd/
comp_op: '='
- sources:
- /webcast/gitlab-enterprise-demo
- /eep-demo
target: /webcast/monthly-release
comp_op: ^~
- sources: /roles/
target: /job-families/
comp_op: '~'
```
## Comparison operators ##
You can use three comparison operators when configuring redirects. They are described in detail below.
### exact match = ###
`=` will create a redirect that requires the user's request to match exactly the expression in `sources`.
For example, if a user clicks on a link that points to the following address or types in their browser: `https://about.gitlab.com/pdfs/resources/gitlab-scaled-ci-cd-whitepaper.pdf` our website will return a 301 redirect which tells the browser to go to `https://about.gitlab.com/resources/whitepaper-scaled-ci-cd/` instead. If the user goes to `https://about.gitlab.com/pdfs/resources/` or `https://about.gitlab.com/pdfs/resources/gitlab-scaled-ci-cd-whitepaper` nothing will happen (they might get a 404 error).
### literal regex ^~ ###
`^~` creates a redirect that is based on very simple regex expressions (literal regex expressions). These expressions are evaluated against the beginning of the request path. As soon as a match is found, the redirect happens which means that if there is a better match below it will not be evaluated.
For example, when a user goes to `https://about.gitlab.com/webcast/gitlab-enterprise-demo` they will be redirected to `https://about.gitlab.com/eep-demo`. If a user goes to `https://about.gitlab.com/webcast/gitlab-enterprise-demo/2019-03-29` they will be redirected to `https://about.gitlab.com/eep-demo` (`/2019-03-29` will be ignored). When a user goes to `https://about.gitlab.com/other/webcast/gitlab-enterprise-demo` nothing will happen.
### regex ~ ###
`~` is used for more complex regex expressions. The script that reads the yml file will create redirects that will try to match at the beginning of the path and will append anything after the match to the target URL. In simple words, they will "replace" part of the path.
For example, `https://about.gitlab.com/roles/engineering/site-reliability-engineer/` will be redirected to `https://about.gitlab.com/job-families/engineering/site-reliability-engineer/`
## Workflow/testing ##
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment