Make Sure Your Wordpress Blog Serves The Right Page The Right Way
Lucia ( Crochet Jane
) posted a code fix for the trailing slashes problem (If you ain’t subscribed to Lucia’s blog, there is just something wrong with you).
The Duplicate Page Problem
Basically the problem is this. If your blog will accept http://yourblogdomain.tld/some-post/
and also accept
http://yourblogdomain.tld/some-post
(the first has a trailing slash and the second doesn’t), then you are dividing your link juice between “two” identical pages, and Google has to figure out which one they want to use. They might decide on the one you wish they hadn’t.
Lets say you are getting oodles of links to the without slashes one, and Google notices that all of your internal links go to the with slashes one. Well, they could decide to prefer the one you are linking to and thus rank your page according to it’s link juice and not the one everyone else is linking to.
That’s a bad thing. Trust me. Or ask Lucia, she’ll tell you the same thing and she has a more trust able face than me.
The Redirection Solution
So, she posted some code you can put into your blog theme’s header.php template that will issue a 301 redirect to the trailing slash version of the page if anyone tries to load the no trailing slash version. A 301 redirect is a “Permanently Moved” redirect which tells Google (and anyone else) that they should stop using the page they tried to use and use this other one instead.
So now when Google finds a link to
http://yourblogdomain.tld/some-post (no slash)
they will get the 301 redirection to
http://yourblogdomain.tld/some-post/ (with slash)
and they will automatically start preferring that version. They will also take and Link Love to the no slash page and apply it to the slash page instead, which means that it gets ranked no matter how anyone links to it.
You have options now. You can visit Lucia and get her code (which is my recommendation), or if you are not comfortable with modifying your template files (it is easy though), you can try using the Permalink Redirect Plugin. I’ve not tried it myself, but I saw a recommendation for it from John Godley, and that’s good enough for me.
Another Redirection Fix
Incidentally, there is an identical problem at the other end of your URIs. Namely it’s the whole www. or not thing. If some links go to
http://www.yourblogdomain.com/
and others go to
http://yourblogdomain.com/
it can cause the same problem. John Godley has a redirection plugin that lets you manage all kinds of cool redirections from your dashboard. One of the configuration options is to either force or strip the www from requests through a 301 redirection.
Pretty cool, huh? And that’s only a tiny bit of what it does.
Popularity: 17% [?]
Like this article?Comments
Thank you! I appreciate your time and Thoughts!Trackbacks/Pingbacks
- TechTraction » Blog Archive » TechTraction Friday Finds for 09/07/07 - Blog Strokes
[...] topics such as themes, plugins, and tutorials to name a few. The most recent post I saw was a nice article presenting 3 ways to make sure WordPress displays the “right page” the &#... Blog Strokes author, Dane Morgan, has a very direct and easy to read writing style, which is [...]
Leave a Reply
Or send a Trackback to this post.You Comment, I Follow. I value your comments and your links are dofollow links.












Add To Technorati Favorites

September 5th, 2007 at 1:12 am
Thanks for the additional pointers Dane, I’m becoming a big fan of your blog
There is also another plugin (not as comprehensive) that will deal with the www or no www which I’ve been using for some time. Authored by Justin Shattuck you can find it at
http://www.justinshattuck.com/wordpress-www-redirect-plugin/
September 5th, 2007 at 7:00 am
Thanks, Maurice, I appreciate that.
I’ll check out Justin’s plugin too. I used to use one that Matt Mullenweg wrote, but since I installed redirection to do a couple of other things I figured I might as well use the built in feature and have one less plugin.
September 10th, 2007 at 3:24 pm
Hi Dane, Today you have been given a blog award for the work you do by Scruffyhippo
September 14th, 2007 at 12:56 pm
Hi Dane. I do the no WWW thing in my htaccess file. Works great.
I went to Lucia’s site and tried the trailing slash optimization. It does not work on my site, so I posted a question as to why over there. If I paste in her code, then try to view the site without the / I just get a blank page.
Anyway, thanks for the tip and the link!
-Will
September 15th, 2007 at 5:42 pm
Yeah, I’m not sure why it wouldn’t work. I’m using it here and it was plug and play with no problems.
I need to talk to some one in the know and find out what happens if you are using separate checks for multiple elements and redirecting separately for them… Like what happens if somehow the redirect triggers another redirect.
September 30th, 2007 at 1:31 am
Interesting post Dane. I have 2 questions:
Is the trailing slash version more preferable to a url without?
2. Can we not accomplish the same thing with a 301 redirect in our domain forwarding dashboard, like GoDaddy provides?
Thanks for the great post.
…BB
September 30th, 2007 at 2:45 am
Sorry Dane, just one more question.
Do you think this method is necessary for Blogger users who don’t have the duplication problem and post pages are html docs and not php?
Or is there still a benefit for them doing this as well?
Thanks again,
…BB
September 30th, 2007 at 7:23 am
Hi BB,
Some people (like me) prefer to have the trailing slash, others prefer not to. It’s really a personal preference thing. The important part of this is that it is always the same either way. Either you only allow the page to load with the slash or without.
As for GoDaddy’s dashboard I can’t answer with complete confidence because I’ve never used GoDaddy. But if it can detect any attempt to load a page on your site and serve a redirect to the canonical version you establish, then yes, that would be fine.
On Blogger, if all of your page URIs end in a .html then this is not an issue for you at all. But if any of those pages end in a directory type reference, then you’ll want to look for solutions to this.
October 1st, 2007 at 4:07 pm
That’s what I thought. I’ve set up Blogger to redirect to my custom domain url and I notice for some reason it always defers to the trailing slash. It must be the way Blogger or GoDaddy does it. So I’ve changed all of my home page urls in the template to do the same.
I’m in the process of porting over to Wordpress so I’ve subscribed to you for future reference
Thanks again for the help Dane.
Cheers!
…BB
June 9th, 2008 at 11:33 pm
In my blogs I have always used an excerpt or summary on the home page to guard against duplicate content through out my blog.
June 27th, 2008 at 2:20 pm
I’m actually trying to find a solution/guide to achieve these page/posts structure for WP blog
Eg ->
Page structure like this :-
domain/page1.html
domain/page2.html
domain/page3.html
But having blog posts structure like this ( I choose the /%postname%/ for post permanent link structure ) :-
domain/myblogpost/
domain/myblogpost2/
…and so on.
Let me know if there is a way to achieve such page/post structure.
Thanks