A 301 redirect is a permanent redirect from one URL to another. It tells browsers and search engines that the page has moved permanently.
Click to reveal answer
beginner
What does a 302 redirect mean?
A 302 redirect is a temporary redirect. It tells browsers and search engines that the page has moved temporarily and may return to the original URL.
Click to reveal answer
intermediate
When should you use a 301 redirect instead of a 302 redirect?
Use a 301 redirect when you want to permanently move a page and transfer SEO value. Use 302 if the move is temporary and you want to keep the original URL indexed.
Click to reveal answer
intermediate
How do browsers handle 301 and 302 redirects differently?
Browsers cache 301 redirects because they are permanent, so they remember the new URL. 302 redirects are not cached as strongly because they are temporary.
Click to reveal answer
beginner
What HTTP header is used to specify the new URL in a redirect?
The 'Location' header is used in the HTTP response to tell the browser the new URL to redirect to.
Click to reveal answer
Which HTTP status code indicates a permanent redirect?
A301
B302
C404
D500
✗ Incorrect
301 means permanent redirect, while 302 means temporary redirect.
What does a 302 redirect tell search engines?
AThe page has moved temporarily
BThe server has an error
CThe page is not found
DThe page has moved permanently
✗ Incorrect
302 means the page is temporarily moved, so search engines keep the original URL indexed.
Which HTTP header contains the new URL in a redirect response?
AContent-Type
BLocation
CAuthorization
DAccept
✗ Incorrect
The Location header tells the browser where to go next.
If you want to permanently move a page and keep SEO value, which redirect should you use?
A302
B404
C301
D200
✗ Incorrect
301 is a permanent redirect and passes SEO value to the new URL.
How do browsers treat 301 redirects compared to 302 redirects?
ADo not cache either
BCache 302 redirects, but not 301 redirects
CCache both equally
DCache 301 redirects, but not 302 redirects
✗ Incorrect
Browsers cache 301 redirects because they are permanent, but treat 302 redirects as temporary and do not cache them strongly.
Explain the difference between a 301 and a 302 redirect and when to use each.
Think about whether the page move is permanent or temporary.
You got /6 concepts.
Describe how browsers handle caching for 301 and 302 redirects.
Consider the permanence of the redirect.
You got /4 concepts.
Practice
(1/5)
1. What does a 301 redirect indicate in a REST API?
easy
A. The resource has been deleted.
B. The resource is temporarily unavailable.
C. The resource has moved permanently to a new URL.
D. The resource requires authentication.
Solution
Step 1: Understand the meaning of 301 redirect
A 301 redirect means the resource has moved permanently to a new location.
Step 2: Compare with other options
Other options describe different HTTP statuses, not 301 redirect.
Final Answer:
The resource has moved permanently to a new URL. -> Option C
Quick Check:
301 redirect = permanent move [OK]
Hint: 301 means permanent move, 302 means temporary move [OK]
Common Mistakes:
Confusing 301 with 302 redirect
Thinking 301 means resource deleted
Assuming 301 is for authentication
2. Which HTTP status code is used for a temporary redirect?
easy
A. 301
B. 302
C. 404
D. 500
Solution
Step 1: Identify status codes for redirects
302 is the standard status code for temporary redirects.
Step 2: Eliminate other codes
301 is permanent redirect, 404 is not found, 500 is server error.
Final Answer:
302 -> Option B
Quick Check:
Temporary redirect = 302 [OK]
Hint: 302 means temporary redirect, not 301 [OK]
Common Mistakes:
Mixing 301 and 302 codes
Choosing 404 or 500 by mistake
Not knowing redirect codes
3. What will be the HTTP status code returned by this REST API snippet?
C. Status code 301 is correct for temporary redirect.
D. Status code should be 302 for temporary redirect.
Solution
Step 1: Check status code for temporary redirect
Temporary redirects require status code 302, not 301.
Step 2: Verify headers
Location header is present and correct, so no error there.
Final Answer:
Status code should be 302 for temporary redirect. -> Option D
Quick Check:
Temporary redirect = 302, not 301 [OK]
Hint: Use 302 status for temporary redirects, not 301 [OK]
Common Mistakes:
Using 301 instead of 302 for temporary redirects
Omitting Location header
Misunderstanding redirect status codes
5. You want to permanently redirect old API endpoints to new ones but keep temporary redirects for beta features. Which status codes should you use for each case?
hard
A. 301 for old endpoints, 302 for beta features
B. 302 for old endpoints, 301 for beta features
C. 404 for old endpoints, 302 for beta features
D. 500 for old endpoints, 301 for beta features
Solution
Step 1: Determine redirect type for old endpoints
Old endpoints moved permanently, so use 301 status code.
Step 2: Determine redirect type for beta features
Beta features are temporary, so use 302 status code.
Final Answer:
301 for old endpoints, 302 for beta features -> Option A