The 301 redirect is a important solution for SEO. It allows you lead the traffic from old pages anked on Google listings to a new domain or page and let know Google about the change of that state.
Let me share my experience and why this kind of redirection for websites is very important.
While I was checking why my website had reduced its ranking in Google in the past, I discovered that a lot of ranked pages in the Google listings were very old. These pages were included in some old version of websites I thought were deleted in the past. The problem is that content may be competing with my own website. The way I got this conclusion is a topic for another post.
Anyway. To avoid my website can be hidden from important keywords I had to apply a redirect 301. So I can redirect that old pages to my updated website, giving the old power in listings to my new version, so Google don’t think my website is full of broken links and duplicate content.
How to do a simple 301 redirection?
Well, in this example I show a code to do it. You have to open the .htaccess located in the root of your website. Open it and insert this code
RedirectMatch 301 ^(.*)$ http://www.mynewwebsite.com/
That code means that you apply a 301 redirect, that is a permanent and fixed. You can apply a 302 if that is temporary and you wish to keep the seo power of your page.
Then this expressión ^(.*)$ indicate you want everything in your website be redirected to “http://www.mynewwebsite.com/” for example.
There are some different codes so you can redirect only one page, or folder to a new domain for example.
That is my homework for you. I hope this tip can be helpful for you.