THE CONNECTIONS BEHIND YOUR BUSINESS
Understanding Website Redirects: 301, 302 and 404
Choose permanent or temporary redirects, handle missing pages honestly, and test Apache rules without loops.
Website redirects help visitors and search engines reach the right page after a URL changes. Learn when to use a 301 or 302, why a 404 is different and how to inspect the actual response.
Start here: 404 is not a redirect
A redirect tells a browser to request another URL. A 404 Not Found says the requested resource was not found; it does not send the visitor elsewhere automatically. A friendly error page can help visitors navigate while retaining the correct 404 response.
| Response | Meaning | Typical use |
|---|---|---|
| 301 | Permanent move | A retired URL with a genuinely equivalent replacement |
| 302 | Temporary redirect | A temporary destination while the original URL remains intended |
| 404 | Not found | An unknown or missing resource |
| 410 | Deliberately gone | A reviewed, intentionally removed resource with no replacement |
Search engines use redirects and response codes as signals, not guarantees of rankings. Do not redirect every obsolete page to the home page; an irrelevant destination can confuse visitors and be treated as a soft 404.
Map intent before writing rules
Inventory the old paths and choose the closest useful replacement. Preserve query parameters where they matter, and explicitly decide what to do with obsolete ones. Test trailing slashes, letter case, encoded paths and pagination rather than assuming one example covers all requests.
A host-only move with unchanged paths needs no blanket content redirect. A new canonical hostname or HTTPS policy needs separate consideration, particularly behind a proxy.
A small Apache example
On Apache with the necessary module and .htaccess permission, this example redirects one exact path. It is configuration to review, not a command to run:
RewriteEngine On
RewriteRule ^old-help/?$ /learn/ [R=301,L]
In a document-root .htaccess, the rule pattern normally has no leading slash. This example assumes /learn/ is the reviewed equivalent and Apache’s normal query-string preservation is desired. Do not paste it into an unrelated directory or overwrite existing application/provider rules.
Back up the active configuration first. Use a temporary redirect during a controlled test where appropriate; permanent redirects can be cached. A local rules test is helpful, but it does not replace checking the actual server and proxy behavior.
Inspect the first response and the chain
curl.exe -I --max-time 15 https://your-domain.example/old-help/
curl.exe -I -L --max-redirs 5 --max-time 15 https://your-domain.example/old-help/
The first command should show the expected status and Location. The second follows redirects and should reach the intended final page without a loop. HEAD handling can differ from GET, so also open the URL in a browser and verify its content.
If HTTPS redirects repeatedly, check the host’s documented proxy scheme handling rather than disabling HTTPS. Avoid creating an open redirect that accepts an arbitrary destination from visitor input.
Keep errors honest and recovery simple
Test a truly missing path and confirm it returns 404, not a 200 error page. Apply 410 only to deliberately approved removals, not unknown customer resources. If rules break routing, restore the backed-up affected configuration and verify canonical and application URLs before retrying.
Official references
Documentation checked 2026-10-18. Examples use reserved names and addresses; replace placeholders only for systems you are authorized to manage. Interfaces and included features depend on your provider and account.
Sign in ↗