: 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
<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.
More posts by @Pope3001725
1 Comments
Sorted by latest first Latest Oldest Best
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.