If you are monetizing your blog, or just want lots of traffic, you need to organize your WordPress templates so that search engines give you the highest possible rank. We all know that one of the things you must avoid is duplicate content. But did you know that Google may think you have duplicate content even though you don’t? Well, you might. It turns out there is a teeny, tiny thing you can do that will eliminate pesky hidden duplicate content. Today’s optimization tips will help you avoid duplicate content and make your pages a bit more crawlable. After you implement it, you will hardly notice any difference in how your blog loads. But it will make a big difference to spiders. What will happens? Well, normally, if you can load a blog post using either of these two addresses: That’s fine for a human being; the don’t notice one address ends with ‘/’ and one doesn’t. However, Google considers the two address to be two pages. So, as far as Google is concerned, you blog has duplicate content. That means lower page rank. That means fewer Pay Per Post opps!
Can I eliminate the duplicate content?
Yep! You can redirect one of the address to the “other” address. Users can still enter either addresses and get to the right place. But the spiders will now know there is only one page.
Make the fix, follow these two steps:
- copy code in the text box below.
- Paste the code into the very top of your header.php file. (This is the “header” file in your template directory.)
Do not leave any blank lines before or after the code. If you want a better view of where to put the code, click to enlarge the image to the right.
After pasting in the code, click update to save your changes.
You are finished !
Still, do check your blog still works. Small things can break this. For example, some browsers change quotes ‘a’ into this `a`. See, the second quotes slant? (The reason I reiterate Sebastians tip’s with a few changes was to make it easier for beginners to cut and paste the code with fewer glitches. I made two other minor changes.)
If your blog broke strip out the code (it probably won’t) and ask someone for help!
Now visit some individual posts. Delete the trailing ‘/’ from a url and reload. WordPress should now add the ‘/’.
Whoo hoo! Duplicate content fixed!
Do you want to learn more SEO secrets you can use to improve your traffic and page rank?
Visit Sebastian’s pamphlets great tips at optimize WordPress for search engines. I’ll be implementing most of these at my blogs.
If you understand his information rich directly, you should go there first. Because I ran into a few snags copying just cutting and pasting quotes, and with a couple of other minor things. I know php so I was able to modify things just a bit to make it easier to cut and paste.
Over the course of the week, I’ll do the same for each tip and explain in my own words why you should use the modifications he suggests. When it helps. I’ll also provide the code with minor modifications that I made to eliminate the snags I ran across.
Thanks
Can’t you write a plugin to prevent WordPress from replacing wonderful plain single and double quotes within code/pre tags with
fancycrappy stuff stolen from M$-Word?I’d rather use that than ugly text areas. You made a valid point though.
If template designers would implement this stuff … sigh … they’re mostly designers and not SEO savvy coders.
Hmmm. I never realized that was a problem. I’ll have to run off and add the code to my blog. I’ll be back if I can’t make it work. Thanks!
@ Sebastian, This does that and a lot more. http://blog.igeek.info/wp-plugins/igsyntax-hiliter/
@Blog Strokes
Looks good but I can’t activate it in WP 2.2.2 coz it produces a fatal error.
@Sebastian,
Probably a plugin conflict. I have it running in 2.2.2 with no modification.
hmmmm, i find this quite fascinating and clever. Great job and good luck with it all
Thanks for this tip. I didn’t know google flags your blog on duplicate contents.. I may not have duplicates but most of the time, I quote from my previous posts.
I copied and pasted the code into my header file, but it broke the site. When I do the test of entering the url without the /, instead of inserting it and loading the page, I just get a blank page.
I just reloaded the original header file, so now the site works, but I would like to be able to implement this. Thanks!
I put the code (before / changes), from my header php file in the WP Pastebin if anyone wants to look at it and see if it is apparent why this optimization tip won’t work on my site.
http://wordpress.pastebin.ca/697772
.
And here is a Pastbin with the header php code after I copy and paste it in. (This is the php file that won’t work).
Thanks for any help.
http://wordpress.pastebin.ca/697775
Thanks! Very strange. Have you ever heard of this? I am not real advanced in this stuff, but I found the bit you described above in my index php file. I put the code in that file and it seems to work great. Make sense to you??
-Will
Actually it is in the index php file in my theme’s files and directory. I have never touched the index php file in the WordPress directory. What is that file for?
I see now that the file in the WP directory only instructs WP to use the one in the theme directory.
Thanks again for this!
I think this is tongue-in-cheek, but I don’t know enough to be sure. I placed the code first in my theme’s Main Template, index.php. When I reread your instructions, and you said “header” I placed a copy of your code in the header.php file of my theme. So far the blog is running fine.
The question is, Is this duplicate content? ;->
My theme template got destroyed; in rebuilding the look and feel, I concentrated first on what the end-user would see. Blog statistics went way down. I was just getting used to having lost many people, and having lost those that the search engines had sent, when I worked behind the scenes and reinstalled this plugin.
Overnight!! Search engine traffic for three-Google, MSN, and AOL-increased 200% each, a couple of 100% search engine increases (from 1 to 2, but still. . .). After I installed the plugin, visits soared 243% the next day, almost to the pre-breakdown high!
I’m sold. Keep this stuff coming.
[...] I wrote that about a month ago? Maybe you wanted to fix the problem, but you didn’t like adding a hunk of code to your header? [...]