--- title: Redirect 301 vs 302 description: "301 is permanent, 302 is temporary. Choosing wrong can hurt SEO and leave visitors stuck with a hard-cached redirect." canonical: https://penasihathosting.com/en/hosting-wiki/redirect-301-302 type: wiki locale: en updated: 2026-10-29 author: Willya Randika --- # Redirect 301 vs 302 ## Overview - **Summary:** 301 is permanent, 302 is temporary. Choosing wrong can hurt SEO and leave visitors stuck with a hard-cached redirect. - **Author:** Willya Randika ([profile](/penulis/willya-randika)) ## Article **A 301 redirect** tells browsers and search engines that a URL has moved **permanently**, while **302** means a **temporary** move. Both send visitors elsewhere, but browser caching and crawler signal handling differ. ## The main difference | Aspect | 301 | 302 | | --- | --- | --- | | Nature | Permanent | Temporary | | Browser cache | Strong, can persist for a long time | Usually weaker than 301 | | SEO signal | Passed to the target URL | Source URL is treated as still valid | | When to use | Domain change, URL restructure | A/B test, maintenance, seasonal promo | There are also **307** and **308**: both preserve the HTTP method (POST stays POST), while 301/302 historically could change the method in some clients. For ordinary websites, 301 and 302 are enough; for APIs, use 307/308 when the method must be preserved. ## How to set a redirect In **cPanel**, open **Domains → Redirects**, choose the domain, fill in the source path and target URL, then pick the type. On **Apache**, an `.htaccess` rule looks like: ```apache Redirect 301 /old-page https://example.com/new-page ``` In **WordPress**, a redirect plugin helps, but make sure rules from plugins, themes, and `.htaccess` do not stack. One URL should be handled by one rule. ## What to watch for - **Avoid redirect chains.** A → B → C slows loading and confuses crawlers. Point directly at the final target. - **Do not use 302 for a permanent change.** You can lose SEO signals and forget to update it. - **Keep HTTPS and www redirects consistent.** Choose one canonical version, then point the rest at it. - **Test with `curl -I`.** Confirm the status and `Location` header before deploying. ## FAQ On the server, yes, but visitors who already cached it may keep opening the old target until their cache expires. Test redirects on staging before applying them. When the source URL really will return, such as a maintenance page, a seasonal campaign, or a test of a new page. One redirect adds one HTTP round trip. Long chains can add hundreds of milliseconds, especially on mobile connections.