Redirect Search Engine Friendly
In todays lesson, I’ll explain how to redirect pages search engine friendly with htaccess. Never loose pagerank and never get penalty’s for duplicating content and/or wrong redirecting again! Read on.
Introduction
I had a problem a couple days back. My blog should be moved from http://www.divitodesign.com/blog to http://www.divitodesign.com/, but I didn’t know how to do this a proper way: a search engine friendly way. Of course, I didn’t want to get any penalty’s for duplication content or any other nasty stuff. I searched Google, and I found a interesting way to do this. It works fine and I’ll explain it to you in this tutorial.
Why not redirect via HTML?
Why should you use .htaccess to redirect? Why not use the simple HTML redirect? For the normal webmaster, the HTML way is much easier because you don’t know anything about the other one. It might be easier but this isn’t really true. Take a moment to learn and it gets even more simple then the HTML one!
So, why not use HTML redirects in search-engine-friendly pages. In the past, HTML redirecting was used by spammers to deceive the SE’s. This black-hat-search-engine-optimization trick is called Cloaking. As you all know, the search engines aren’t stupid and today a HTML redirect gets a penalty. Therefore, we are going to use an other and better way.
Explaining the 301 redirect
The redirect we are going to use is the so-called “301 redirect”. Normally, when someone visits a webpage they’ll get code 200 (green light everything is OK). We have moved this original file and we want the visitors of the old page to not see a 404 code (an error page). Because simply they will not come back. More important; the Search Engines are visitors as well and when they see a 404 error, they’ll delete this webpage from the search results. We are going to tell the SE’s the page is moved permanently and tell them its new home (with a 301 code).
Step by Step
Make sure you are on a Apache server, this method will not work on a Windows based hosting solution.
- Create a new file in the root directory of your website. You should name this file “.htaccess” (don’t forget there shouldn’t be anything before the dot).
- Open the file with a plain text editor like Notepad
- Add the following codes to the file:
Redirect 301 /old/directory/file.html http://www.website.com/new/directory/file.html
Explanation
Here is a small explanation. Redirect will simply do the redirect. 301 tells the search engine the page is moved permanently. /old/directory/file.html is the path to the old file. Do NOT use “http://www.website.com”, it will not work. http://www.website.com/new/directory/file.html is the URL the new page is located.
Conclusion
Now you know how to do this little trick. I guess it is even more simple then the HTML redirect. I hope you’ve learned something in today’s lesson.




A great tutorial, thanks for sharing.
Hi, thanks for the information.
Do you just put the .htaccess file in the root directory? or do you need to do something in your webpage?
Sio: Yes, you should put this file in the root directory of your domain and you do not have to change anything in your webpage.
Thanks for the comments.
Very nice! Thanks for sharing.
I have a question.
What if we use a server side scripting function like “header” in PHP for redirect? Is it same as 303? How is it different from the HTML redirect?
Thanks for your comment. It is possible to redirect in PHP as well, search engine friendly. This can be achieved with this:
< ?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: new-url.com" );
?>
Doing a HTML redirect isn’t really possible in SEO land, because spammers abused the technique. You should use the PHP or .htaccess redirect.
[...] http://www.divitodesign.com/2008/02/redirect-search-engine-friendly/ [...]
I am looking at maybe switching to Drupal god knows this post comes in handy lol.
I currently have a number of static sites which I want to convert into blogs. I had no idea about how to do redirects so this is very helpful to me. Thanks.
Thank you
Wish I would have found this post when I was setting up my site. Excellent info here.
Thanks for usefull info. Gonna try it on my new website.
Is there a way for my PHP scripts loading pages from a location, to see if a redirect is 301 by .htaccess or an HTML redirect?
I would like to use this info in my website quality test. So far I thought all redirects were unpopular with search engines. Now I understand this is not the case, I need to be able to tell the two apart.
I don’t really understand what you mean, Lars. I understand you are Dutch, could you explain it to me via email? I will try to answer your question.
-EDIT-
I now do understand what you mean. You want some kind of “redirect-checker” to build inside your meta-tool. I suggest you take a look at this tool: SEO Redirect Checker. The codes are provided, so it might be possible to build that in your own tool! By the way, I love your tool, it pointed out some great things to me as well!
Thanks
Thanks for the great article about search engine friendly redirects. You did a great job breaking up the explanation into the what a 301 redirect is, why to implement a 301 redirect instead of another kind of redirect, and how to implement it. I always know a great article when I can use it now and bookmark it for later.
A great tutorial, thanks for sharing.
[...] And if i do at some point, then I have to migrate all the posts, comments, etc. over to the new site. Then do a little trick so that the search engines don’t wipe me out of their listings because of duplicate content – this involves, from what I’ve read, putting a 301 redirect in the .ht … something or other. On the server. At the “root level”. You techfreaks can read about it here. [...]
thanks for that, i will take my experience with my htaccess-files….
Redirects are especially helpful when you change your branding. We are still getting traffic from our four year old predecessor site. We at Crown SEO, Ltd. have seen blogs and sites skyrocket overnight into number one Google position through the use of white hat SEO tools so the concepts of this blog are correct.
I have also try it and it really works
Stefan,this was just the tutorial-type explanation I was looking for. I’m trying to make all my pages, like mysite.com go to http://www.mysite.com…the difference is the www. because if mysite.com has 200 inbound links and http://www.mysite.com has 400 inbound links, and you do a 301 redirect then Google will know that you have a real total of 600 inbound links. Anyway, my purpose for needing the htaccess is a bit different than the use you were suggesting (which will come up one day I’m certain), but it works for my purpose too! Thanks!
That’s a good strategy for sure. Thank you for the information!
such a important skill to master. 301 is the correst answer to this
SEO Company Leeds
Yeah, thanks for sharing i didn’t know how to do this before. Thanks
Thank you so much for the post! Having a better understanding of redirects has helped immensely, especially the 301 redirects. Many of our clients have landing pages that change so often…this was very helpful.
yep, 301 all the way.. can also pass over page rank if you are lucky.
It’s important to make sure not to manipulate any other part of the htaccess file. Be very careful when editing this file.
Thanks for your help, this info really helped me out. Now all I need to figure out is how to get .htaccess to redirect my 404, 405 errors, any tips?
Thanks