HTTP 301 Moved Permanently vs 302 Found
Both 301 and 302 are redirect status codes, but they differ in permanence. A 301 tells clients and search engines that the resource has moved permanently, while a 302 indicates a temporary redirect that should not update bookmarks or cached URLs.
説明
The resource has been permanently moved to a new URL. All future requests should use the new URL. Search engines will transfer link equity to the new URL.
このコードが表示される場合
After domain migrations, URL restructuring, or when consolidating duplicate URLs.
修正方法
Update links and bookmarks to the new URL in the Location header. For SEO, this is the preferred redirect for permanent moves.
説明
The resource temporarily resides at a different URL. The client should continue using the original URL for future requests.
このコードが表示される場合
During A/B testing, temporary maintenance pages, or geo-based redirects.
修正方法
Follow the Location header. Note: browsers may change POST to GET on redirect.
主な違い
301 is permanent — browsers cache the redirect and search engines transfer link equity to the new URL.
302 is temporary — browsers do not cache the redirect and search engines keep indexing the original URL.
301 may cause some older clients to change POST requests to GET (method rewriting), while 302 has the same ambiguity.
Use 301 for domain migrations, URL restructuring, or when the old URL will never return.
Use 302 for A/B tests, maintenance pages, or geo-based routing where the original URL remains valid.
使い分け方
Use 301 when a resource has permanently moved and you want search engines to index the new location. Use 302 when the redirect is temporary and the original URL should retain its search ranking. If you need to preserve the HTTP method (POST stays POST), consider 307/308 instead.