June 2018
Beginner to intermediate
394 pages
9h 2m
English
URL redirects help to avoid broken link situations and are also used for URL shortening. When a browser tries to open the shortened URL, or a URL that has moved to another destination, using redirects we can still reach the expected page. Fundamentally, redirects can be configured in the firebase.json file in the project setup. Consider the following example:
"hosting": { // Add the "redirects" section within "hosting" "redirects": [ { "source" : "/foo", "destination" : "/bar", "type" : 301 }, { "source" : "/firebase/*", "destination" : "https://firebase.google.com", "type" : 302 } ]}
foo is the source, but when you use a bar as your redirected route, the browser will load the content within the bar URL. The source field is a
Read now
Unlock full access