{"id":786,"date":"2019-08-27T16:06:00","date_gmt":"2019-08-27T16:06:00","guid":{"rendered":"http:\/\/blog.webhosting.uk.com\/2006\/12\/24\/301-vs-302-redirect\/"},"modified":"2025-10-24T11:43:49","modified_gmt":"2025-10-24T11:43:49","slug":"301-vs-302-redirect","status":"publish","type":"post","link":"https:\/\/www.webhosting.uk.com\/blog\/301-vs-302-redirect\/","title":{"rendered":"Difference Between 301 Vs 302 Redirect -Which and When to Use?"},"content":{"rendered":"\r\n<p class=\"ai-optimize-6 ai-optimize-introduction wp-block-paragraph\">Sometimes we need to change our URLs for specific reason. for eg. To change the page name from index.html to index.php or or to change domain name for using our keywords in them for ranking, Just renaming them will not serve our purpose because old pages will still be available for user and they will get 404 error pages for those renamed pages, worst is for spiders they may get lost in such case.<\/p>\r\n\r\n\r\n\r\n<p class=\"ai-optimize-7 wp-block-paragraph\">The solution for this is to use redirects. We can implement the change in name without affecting SEO by using redirects such as 301 redirect or 302 redirect.<\/p>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading ai-optimize-8\">301 Redirect (Permanent redirect)<\/h2>\r\n\r\n\r\n\r\n<p class=\"ai-optimize-9 wp-block-paragraph\">It is best method for redirecting. It tells spiders\/visitors that the requested page has been moved permanently at a new specified location. Implementing 301 redirects is very risky job, if anything gets wrong while using 301 your <strong>site<\/strong> will get out of search results, there are many webmasters who have suffered.<\/p>\r\n\r\n\r\n\r\n<p class=\"ai-optimize-10 wp-block-paragraph\">There are several methods of using the 301 redirect, you can use redirect in PHP, redirect in ASP, redirect in ASP .NET, redirect in JSP (JAVA), redirect in IIS, redirect in ColdFusion, redirect in CGI\/PERl , redirect with mod_rewrite and finally the one I find most useful, the redirect using htaccess.<\/p>\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li class=\"ai-optimize-11\"><strong>301 Redirect using .htaccess : ( On Linux server )<\/strong>\r\n<p class=\"ai-optimize-12\">Using htaccess to accomplish the 301 redirect is highly suggested due to it being fairly convenient to manage, rather than setting redirects on each individual page, you can simply add the redirect code to the .htaccess file.<\/p>\r\n<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<ul class=\"wp-block-list\">\r\n<li class=\"ai-optimize-13\"><strong>301 Redirect for IIS : ( On Windows server )<\/strong>\r\n<p class=\"ai-optimize-14\">In Internet Services Manager, right click on the file or folder you wish to redirect. Select the radio titled &#8220;a redirection to a URL&#8221;. Enter the redirection page, check &#8220;The exact url entered above&#8221; and the &#8220;A permanent redirection for this resource&#8221;. Click &#8220;Apply&#8221;.<\/p>\r\n<\/li>\r\n<\/ul>\r\n\r\n\r\n\r\n<h2 class=\"wp-block-heading ai-optimize-15\">302 Redirect (Temperory redirect)<\/h2>\r\n\r\n\r\n\r\n<p class=\"ai-optimize-16 wp-block-paragraph\">It can be considered as a command line invitation for getting your site banned, since search engines don&#8217;t like temporary redirects.<\/p>\r\n\r\n\r\n\r\n\r\n","protected":false},"excerpt":{"rendered":"<p>Sometimes we need to change our URLs for specific reason. for eg. To change the page name from index.html to index.php or or to change domain name for using our&hellip;<\/p>\n<p><a href=\"https:\/\/www.webhosting.uk.com\/blog\/301-vs-302-redirect\/\" class=\"more-link\">Read More<\/a><\/p>\n<div class='heateorSssClear'><\/div><div  class='heateor_sss_sharing_container heateor_sss_horizontal_sharing' data-heateor-sss-href='https:\/\/www.webhosting.uk.com\/blog\/301-vs-302-redirect\/'><div class='heateor_sss_sharing_title' style=\"font-weight:bold\" >Spread the love<\/div><div class=\"heateor_sss_sharing_ul\"><a aria-label=\"Facebook\" class=\"heateor_sss_facebook\" href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=https%3A%2F%2Fwww.webhosting.uk.com%2Fblog%2F301-vs-302-redirect%2F\" title=\"Facebook\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg\" style=\"background-color:#0765FE;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path fill=\"#fff\" d=\"M28 16c0-6.627-5.373-12-12-12S4 9.373 4 16c0 5.628 3.875 10.35 9.101 11.647v-7.98h-2.474V16H13.1v-1.58c0-4.085 1.849-5.978 5.859-5.978.76 0 2.072.15 2.608.298v3.325c-.283-.03-.775-.045-1.386-.045-1.967 0-2.728.745-2.728 2.683V16h3.92l-.673 3.667h-3.247v8.245C23.395 27.195 28 22.135 28 16Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"X\" class=\"heateor_sss_button_x\" href=\"https:\/\/twitter.com\/intent\/tweet?text=301%20vs%20302%20Redirects%3A%20Key%20Differences%20Explained%20-%20WHUK&url=https%3A%2F%2Fwww.webhosting.uk.com%2Fblog%2F301-vs-302-redirect%2F\" title=\"X\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_x\" style=\"background-color:#2a2a2a;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg width=\"100%\" height=\"100%\" style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#fff\" d=\"M21.751 7h3.067l-6.7 7.658L26 25.078h-6.172l-4.833-6.32-5.531 6.32h-3.07l7.167-8.19L6 7h6.328l4.37 5.777L21.75 7Zm-1.076 16.242h1.7L11.404 8.74H9.58l11.094 14.503Z\"><\/path><\/svg><\/span><\/a><a aria-label=\"Linkedin\" class=\"heateor_sss_button_linkedin\" href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=https%3A%2F%2Fwww.webhosting.uk.com%2Fblog%2F301-vs-302-redirect%2F\" title=\"Linkedin\" rel=\"nofollow noopener\" target=\"_blank\" style=\"font-size:32px!important;box-shadow:none;display:inline-block;vertical-align:middle\"><span class=\"heateor_sss_svg heateor_sss_s__default heateor_sss_s_linkedin\" style=\"background-color:#0077b5;width:40px;height:40px;display:inline-block;opacity:1;float:left;font-size:32px;box-shadow:none;display:inline-block;font-size:16px;padding:0 4px;vertical-align:middle;background-repeat:repeat;overflow:hidden;padding:0;cursor:pointer;box-sizing:content-box\"><svg style=\"display:block;\" focusable=\"false\" aria-hidden=\"true\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 32 32\"><path d=\"M6.227 12.61h4.19v13.48h-4.19V12.61zm2.095-6.7a2.43 2.43 0 0 1 0 4.86c-1.344 0-2.428-1.09-2.428-2.43s1.084-2.43 2.428-2.43m4.72 6.7h4.02v1.84h.058c.56-1.058 1.927-2.176 3.965-2.176 4.238 0 5.02 2.792 5.02 6.42v7.395h-4.183v-6.56c0-1.564-.03-3.574-2.178-3.574-2.18 0-2.514 1.7-2.514 3.46v6.668h-4.187V12.61z\" fill=\"#fff\"><\/path><\/svg><\/span><\/a><\/div><div class=\"heateorSssClear\"><\/div><\/div><div class='heateorSssClear'><\/div>","protected":false},"author":147,"featured_media":16899,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1217],"tags":[],"ppma_author":[2389],"class_list":["post-786","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-web-design-development"],"authors":[{"term_id":2389,"user_id":147,"is_guest":0,"slug":"niraj-chhajed","display_name":"Niraj Chhajed","avatar_url":{"url":"https:\/\/www.webhosting.uk.com\/blog\/wp-content\/uploads\/2016\/10\/1671629317463.jpg","url2x":"https:\/\/www.webhosting.uk.com\/blog\/wp-content\/uploads\/2016\/10\/1671629317463.jpg"},"author_category":"1","user_url":"https:\/\/www.webhosting.uk.com\/","last_name":"Chhajed","first_name":"Niraj","job_title":"","description":"I'm a SEO and SMM Specialist with a passion for sharing insights on website hosting, development, and technology to help businesses thrive online."}],"_links":{"self":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts\/786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/users\/147"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/comments?post=786"}],"version-history":[{"count":11,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts\/786\/revisions"}],"predecessor-version":[{"id":20502,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/posts\/786\/revisions\/20502"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/media\/16899"}],"wp:attachment":[{"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/media?parent=786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/categories?post=786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/tags?post=786"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.webhosting.uk.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}