WordPress users - sharpen your URLs with Google!
First of all you must enable the permalinks, but that you probably already have done.
Now to the point. Did you know that these are all different URLs for the same blog post?
http://www.myblog.com/my-blog-post
http://www.myblog.com/my-blog-post/
http://myblog.com/my-blog-post
http://myblog.com/my-blog-post/
Google sees this as 4 different URLs and 4 different pages when in fact it is only one. One of them will rank higher in Google than the rest. This is called canonicalization problem and is discussed by a Google staff here.
Let’s say you get a nice link to http://www.myblog.com/my-blog-post but in fact it is http://www.myblog.com/my-blog-post/ that ranks higher. This link is useless in terms of ranking!
The solution to get all 4 versions made into only one and to have all weight/power transferred to that one
Add the following lines in the .htaccess file before the WordPress permalinks lines:
Options +Indexes
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^myblog\.com
RewriteRule ^(.*)$ http://www.myblog.com/$1 [R=permanent,L]RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ http://www.myblog.com/$1/ [L,R=301]
That will make all posts go to this version: http://www.myblog.com/my-blog-post/
Just replace myblog before you add it and don’t forget to still include the WordPress permalinks section in the .htaccess file.
Let me know any feedback, ideas, comments etc.
Marcus said,
January 24, 2006 @ 2:48 pm
Great post Jim!
I used it!
mazhar said,
February 3, 2006 @ 3:20 pm
hi.
wow! real imp info. but could you please let me know wether such a trick can be done for a blogger account.
Jim Westergren said,
February 3, 2006 @ 5:39 pm
Hmm. Sorry I don’t know how blogger works. I think WordPress is better.
By the way, yes it is important info. Please tell your friends or blog a link to me
Russell said,
February 12, 2006 @ 7:01 am
Would this code have to be modified if I was using the Subster Rejuvenation plugin to use wildcard dns to make post category a subdomain?
Jim Westergren said,
February 12, 2006 @ 3:35 pm
Russell,
Oh, that I cannot answer to. But if your WordPress post URLs look like the ones above you could try it and see if it works.
Also would be nice if you commented back here on how it went
Nata said,
March 9, 2006 @ 7:13 pm
Excellent article !