Here is the 301 redirect instruction, how to do it on your site.
First you have to create a blank file and ftp it to your server in public html folder if you are using CMS - Content Management Systems or just the root folder of your site.
The file name should be
.htaccess
so be careful to put the . in front of the filename or it would not work.
And this is to put into your htaccess file
RewriteEngine on
rewritecond %{http_host} ^xxxxxxxx.com [nc]
rewriterule ^(.*)$ http://xxxxxxxxxxx.com/$1 [r=301,nc]
Let me give you a sample with my site. My domain is like you can see http://www.seoandwebdesign.com
So if I want to redirect all the pages without www to the pages with www the code will look like that
RewriteEngine on
rewritecond %{http_host} ^seoandwebdesign.com [nc]
rewriterule ^(.*)$ http://www.seoandwebdesign.com/$1 [r=301,nc]
So for example the page like this
http://seoandwebdesign.com/blogsection/blog/
will be redirected to
http://www.seoandwebdesign.com/blogsection/blog/ (the first url is without www)
So you are asking yourself why to use redirect. Because of duplicate google problem. Google doesn't like duplicate content - no way - so each of my page without the 301 redirect enabled will have duplicate page because google thinks url with www and without are 2 different pages so that is kind f strange if you ask me. But here you go. I suggest to make 301 redirect on all of your sites.
Also her is the option if you want to redirect all urls with www to the non www urls.
Here is the code
RewriteEngine on
rewritecond %{http_host} ^www.seoandwebdesign.com [nc]
rewriterule ^(.*)$ http://seoandwebdesign.com/$1 [r=301,nc]
I only switched the www.
Note* This .htaccess method of redirection works ONLY on Linux servers having the Apache Mod-Rewrite moduled enabled.
REDIRECT ONE PAGE TO ANOTHER
This comes handy if you change the page or move it to another url adress.
Here is the code that you have to insert into .htaccess
And for example I want to redirect this page
http://www.seoandwebdesign.com/welcome_to_renoseowebdesign.com.html
to
http://www.seoandwebdesign.com/
because I do not want to have 2 pages with the same content on it. That is called duplicate content and it is so silly if you ask me. SO here is the code for that example
Add new comment