Mobile app version of vmapp.org
Login or Join
Pope3001725

: How use a canonical link tag in a dynamic page? <link rel="canonical" href="http://www.example.com/category/subcategory/example-product/product-id" /> I have a whole bunch of query string URLs

@Pope3001725

Posted in: #CanonicalUrl #DuplicateContent #Dynamic #ModRewrite #Url

<link rel="canonical" href="http://www.example.com/category/subcategory/example-product/product-id" />


I have a whole bunch of query string URLs (company products) that I have rewritten to friendly ones (such as that indicated above). At present, seems search engines are still seeing both versions, so I thought perhaps I should add the canonical tag to my preferred URL.

Incredibly, days and days of trolling god-knows-what web development resources on the internet has not clearly answered the question of "how" for me. Hoping someone here can help.

For the record, I am utilizing a single file (products1.php) to populate all of my products.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Pope3001725

1 Comments

Sorted by latest first Latest Oldest Best

 

@Megan663

products1.php simply needs to output the canonical link in the head section of the page. Presumably it knows the information needed to build your friendly URL:


category
subcategory
product name
product id


Then the canonical tag appears in both the page for the friendly URL and the page for the parameterized URL. That is fine. Google says that a canonical link that points to the current page would be OK.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme