
301 Redirect Puzzle Solved |
|
| Htaccess |
| Sunday, 24 December 2006 15:31 |
|
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
Options +FollowSymlinks 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
Options +FollowSymlinks
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
Options +FollowSymlinks
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
Redirect permanent /old/page.html http://your.site/new/page.html
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
Redirect permanent /welcome_to_renoseowebdesign.com.html http://www.seoandwebdesign.com
|
Dragon Naturally Speaking I complete...
Newly Updated Bookmarking Sites 2012 ...
Great thanks, looks like i have alot ...
I totally agree that the taxonomy suc...
Hey There. DId you resolve your p...
yes you are right, this company is ho...
For years and years now I have been r...
Thanks for posting this great article...
I just bought this dvd 1 week ago and...
Excellent read, I just passed this on...
Really meaningful picture
whats wrong with taxonomy, yes Joomla...
I love drupal in-fact I have now desi...
great work, how much you charge per p...
I agree that "the profiles are of...