{"id":38,"date":"2020-07-12T00:30:04","date_gmt":"2020-07-11T19:30:04","guid":{"rendered":"http:\/\/iadnanahmed.com\/?p=38"},"modified":"2020-07-12T00:20:09","modified_gmt":"2020-07-11T19:20:09","slug":"what-is-a-301-redirect-and-how-to-setup-it-in-htaccess-file","status":"publish","type":"post","link":"https:\/\/iadnanahmed.com\/what-is-a-301-redirect-and-how-to-setup-it-in-htaccess-file\/","title":{"rendered":"What is a 301 Redirect? And how to setup it in htaccess file?"},"content":{"rendered":"
Question: What is a 301 Redirect? And how to setup it in htaccess file?<\/strong> If you are a Website Owner, Web Developer<\/a>, or Webmaster, there are certain times when you need to move your website from one URL to another.<\/p>\n And you want to ensure all of your visitors reach the correct URL as well as Search Engine Robots.<\/p>\n In the tech world, this is called 301 Redirect<\/strong>, 301 Moved Permanently<\/strong>, or Permanent Redirect<\/strong>. If you are very concerned about the SEO of your website, then 301 Redirect is very useful to stop any unseen content duplication.<\/p>\n A 301 Redirect is your best friend in the World of Web as it keeps your hard-earned Search Engine Ranking when the site’s URL is changed for any reason. It seamlessly sends search engines and the visitors to the new URL, although the requested URL is an old one.<\/p>\n In this guide, you will learn:<\/p>\n <\/p>\n Sometimes back, there was a very detailed article about “What is a 301 Redirect?”<\/strong><\/em> by Network Solutions on Google Search but now it is moved.<\/p>\n <\/p>\n Never mind, I will try to explain what is a 301 Redirect<\/em> and how to setup<\/em> to redirect your website URLs without losing any of your SEO done.<\/p>\n The 301 Redirect<\/em><\/strong> or status code 301 Moved Permanently<\/em><\/strong> means a webpage is moved permanently from the old URL to a new URL.<\/p>\n It will redirect a visitor and search engine to the new URL once they type the old URL in the browser or click from the search engine result page.<\/p>\n To understand it, Let’s say you type blog.iadnanahmed.com<\/a> in the browser address bar and hit enter, it will be redirected to iadnanahmed.com\/blog<\/a> with status code 301, telling the browser the site URL is moved permanently to the new one.<\/p>\n To achieve this, I simply did a redirect in the .htaccess file as in the screenshot below.<\/p>\n <\/p>\n And to simply verify everything is working as expected, there are few extensions for different browsers, but I use Redirect Path for Google Chrome, which shows redirect path as below.<\/p>\n <\/p>\n <\/p>\n Now the question comes, “How to setup 301 redirect in .htaccess file?”<\/strong><\/em> Just follow my guide below which will help you to solve this problem.<\/p>\n If your website is PHP based or WordPress website, the method of doing redirect in .htaccess is the same.<\/p>\n First of all, you need to create a new .htaccess file if not already there. Use a file manager on your cPanel or Plesk hosting or any popular website manager to create or update.<\/p>\n In the case of cPanel hosting:<\/p>\n First click on the File Manager icon<\/a><\/p>\n The second step is to go to the public_html folder.<\/a><\/p>\n Create a new .htaccess file if it is the first time; otherwise, you can edit the existing one.<\/p>\n\n
What is a 301 Redirect?<\/h2>\n
How to setup 301 Redirect in .htaccess file?<\/h2>\n