0
0
Firebasecloud~5 mins

Redirect and rewrite rules in Firebase - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a redirect rule in Firebase Hosting?
A redirect rule sends visitors from one URL to another URL automatically. It changes the address shown in the browser.
Click to reveal answer
beginner
What does a rewrite rule do in Firebase Hosting?
A rewrite rule serves content from a different location without changing the URL in the browser. It keeps the original URL visible.
Click to reveal answer
intermediate
How do you define a redirect rule in Firebase Hosting configuration?
You add a 'redirects' section in firebase.json with 'source' (the URL to match) and 'destination' (where to send users), plus a 'type' for HTTP status code.
Click to reveal answer
intermediate
Why use rewrite rules for single-page applications (SPA)?
Rewrite rules send all URL requests to the SPA's main index.html file, so the app can handle routing internally without server errors.
Click to reveal answer
beginner
What HTTP status code is commonly used for permanent redirects in Firebase?
The HTTP status code 301 is used for permanent redirects, telling browsers and search engines the change is permanent.
Click to reveal answer
In Firebase Hosting, what happens when you set a rewrite rule?
AThe site reloads with a 404 error
BThe browser URL changes to the new destination
CThe user is blocked from accessing the site
DThe URL in the browser stays the same but content is served from another location
Which section in firebase.json defines redirect rules?
Aheaders
Bredirects
Crewrites
Dfunctions
What HTTP status code should you use for a temporary redirect in Firebase?
A301
B404
C302
D500
Why are rewrite rules important for SPAs hosted on Firebase?
AThey allow the app to handle routing without server errors
BThey block unwanted users
CThey speed up image loading
DThey change the URL to a new domain
Which Firebase Hosting feature changes the URL shown in the browser?
ARedirect rules
BRewrite rules
CHeaders
DCaching
Explain the difference between redirect and rewrite rules in Firebase Hosting.
Think about what the user sees in the browser address bar.
You got /4 concepts.
    Describe how you would configure Firebase Hosting to support a single-page application using rewrite rules.
    Consider how SPAs handle navigation internally.
    You got /4 concepts.