Setting Up a Permanent 301 Redirect in .htaccess
A permanent 301 redirect in your .htaccess file lets search engines and others know that an old link has been replaced by a new one. It’s the recommended method for directing traffic from an existing page.
You can redirect using 301 as many urls as you want but it will cause an increase in processing load if an extremely large .htaccess file has to be processed.
redirect 301 /a1.html /a2.html
This is because the file has to be processed on each request to the server
why 301 redirects are important for SEO
- If you make a new site and simply remove the old one no one will be able to find your new site.
- If someone has a page on your site bookmarked and tries to visit it they’ll just get a page not found message. They’ll get the same error if they type your website address directly into their browser or click on your site on a search result on Google.
- If you 301 redirect all the pages on your old site then if someone clicks on the old page they’ve bookmarked it’ll automatically take them to the new page on the new website.
- It’s the same thing if they type the URL into their browser or click on a search result. They’ll automatically be taken to the new page on the new site and think, “wow, they made a new website, it looks great”.
- They probably won’t even realize that the URL changed but that’s ok because they’re still using your website
- When you 301 redirect a page from an old URL to a new one you’re telling search engines that they shouldn’t show the old page and instead should show the new page.
- Search engines will realize that the page has changed location and there’s a new URL for the page that they should show in their search results instead.
- More importantly, 90% to 99% of the “link juice” or search rankings that the old page has built up will flow to the new page.
- A huge amount of your search engine rankings come from getting links to your site. If you get a ton of good quality links to a page on your site and that site ranks number 1 on Google for a particular keyword but then move the page to a new URL you have to start over. Your new page will rank at the bottom of Google until you’re able to build up links to the new page.
- Using a 301 redirect though you can still get almost all the ranking power that you were getting from the old page. Even though other sites are linking to the old URL that URL links to the new one and the ranking power of your old page flows to your new one.
- It does take a while for search engines to figure out what’s going on but after a little while the new page should start showing up in the number 1 position like your old page was.