Duplicate URLS's

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
eshban
Forum Contributor
Posts: 184
Joined: Mon Sep 05, 2005 1:38 am

Duplicate URLS's

Post by eshban »

Hello. I am breaking my head about something that should be quite easy I quess. I have a dynamic website that caused a lot of duplicate content items.

htt​p:/​/ww​w.example.nl​/in​dex​.ph​p?o​pti​on=​com​_fo​rme​&It​emi​d=2​8&f​unc​=th​ank​you​&di​d=3​54&​fon​tst​yle​=f-​sma​lle​r

htt​p:/​/ww​w.example.nl​/in​dex​.ph​p?o​pti​on=​com​_fo​rme​&It​emi​d=2​8&c​olo​rst​yle​=gr​een

htt​p:/​/ww​w.example.nl​​/in​dex​.ph​p?o​pti​on=​com​_fo​rme​&It​emi​d=2​8&w​idt​hst​yle​=w-​wid​e

As you can see there are multiple variables in the url (and the combinations are many). As all these pages point to one article this causes a lot of duplicate content

Can anyone guide that how to fix this problem?
User avatar
twinedev
Forum Regular
Posts: 984
Joined: Tue Sep 28, 2010 11:41 am
Location: Columbus, Ohio

Re: Duplicate URLS's

Post by twinedev »

If you main issue is search engines finding duplicate content, you can use program the following tag, basically when your site is generating the page to display, you should know what the "base" version of the URL is. If the current URL does NOT match that, then you put it in the href in the tag below (use full url) and place it in the <head> section.

<link rel="canonical" href="htt​p:/​/ww​w.example.nl​/in​dex​.ph​p?o​pti​on=​com​_fo​rme​&It​emi​d=2​8" />

This tells the search engines that the current URL is the same page as the specified URL, so it knows you are not just duplicating content across pages.

-Greg
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Duplicate URLS's

Post by JakeJ »

eshban,

You didn't specify what you're trying to do with the URL's.

You could put your URL's in an array, run them through a preg_replace and strip off everything after Itemdid= then do array_unique and you'll be left with unique arrays.
Post Reply