HTTP Header Canonical Tags
-
I want to be able to add canonical tags to http headers of individual URL's using .htacess, but I can't find any examples for how to do this.
The only example I found was when specifying a file: http://www.seomoz.org/blog/how-to-advanced-relcanonical-http-headers
N.B. It's not possible to add regular canonical tags to the of my pages as they're dynamically generated.
I was trying to add the following to the .htaccess in order to add a canonical tag in the header of the page http://frugal-father.com/is-finance-in-the-uk-too-london-centric/, but I've checked with Live HTTP headers and the canonical line isn't showing :
<files "is-finance-in-the-uk-too-london-centric="" "="">Header add Link "<http: frugal-father.com="">; rel="canonical"'</http:></files>
Any ideas?
-
I've cracked it with the following:
<filesmatch "="" is-finance-in-the-uk-too-london-centric="" $"=""></filesmatch>
Header set Link "<http://frugal-father.com/>; rel="canonical""
<filesmatch "="" charity-skydiving-at-a-uk-parachute-centre="" $"=""></filesmatch>
Header set Link "<http://frugal-father.com/>; rel="canonical""
I can now add as many files matches and header sets as I like within the IfModule, and the canonical tags appear in the HTTP header.
For anyone else reading this, it may need tweaking depending on which version of Apache you're using. i.e. 'FilesMatch' and 'Head set Link' could be 'Files' or 'Header add Link'.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Hreflang in header...should I do a Sitemap?
A client implemented hreflang tags in the site header. MOZ says you aren't supposed to do an hreflang Sitemap as well. My question is how should I do a Sitemap now (or should I do one at all)?
Intermediate & Advanced SEO | | navdm0 -
Proper Title Tags for ecommerce
In terms of E-commerce title tags. We are a manufacturer of our own clothing products. We are new to the SEO landscape so if this question is an obvious answer, then i apologize for wasting any one times in advance. We Manufacture our own clothing. Each item has a name. The names are American womens names such as amanda or lori or jenniffer etc. When we create the title tag for them should we include the name of the item itself at the beginning or end. For example should it be Item Name - Keyword - Keyword - Brand Name(aka manufacturer) or Keyword - Keyword - Item Name - Brand Name (aka manufacturer) The reason we ask this is because we think it would be a waste to rank for actual American names such as Jennifer and Jessica. All that we have read on Moz suggests that it seems to be better to have pertinent keywords in the beginning of the title as opposed to the end. In terms of our brand name we already rank number 1 for every combination of our brand. So we would like to start picking up traffic for the different product types we sell and there respective synonyms. Not sure if i am making any sense. Sorry in advance, and any help is very very much appreciated.
Intermediate & Advanced SEO | | Imagination0 -
Appropriate use of rel canonical
Hey Guys,I'm a bit stuck. My on-page grade indicated the following two issues and I need to find how how to fix both issues.If you have a solution, could you please let me know how to address these issues? It's all a bit intimidating at the moment!!Thank you so much..****************************************************************************************************************************************Appropriate Use of Rel Canonical If the canonical tag is pointing to a different URL, engines will not count this page as the reference resource and thus, it won't have an opportunity to rank. Make sure you're targeting the right page (if this isn't it, you can reset the target above) and then change the canonical tag to reference that URL. Recommendation: We check to make sure that IF you use canonical URL tags, it points to the right page. If the canonical tag points to a different URL, engines will not count this page as the reference resource and thus, it won't have an opportunity to rank. If you've not made this page the rel=canonical target, change the reference to this URL. NOTE: For pages not employing canonical URL tags, this factor does not apply. No More Than One Canonical URL Tag The canonical URL tag is meant to be employed only a single time on an individual URL (much like the title element or meta description). To ensure the search engines properly parse the canonical source, employ only a single version of this tag. Recommendation: Remove all but a single canonical URL tag
Intermediate & Advanced SEO | | StoryScout1 -
How to Disallow Tag Pages With Robot.txt
Hi i have a site which i'm dealing with that has tag pages for instant - http://www.domain.com/news/?tag=choice How can i exclude these tag pages (about 20+ being crawled and indexed by the search engines with robot.txt Also sometimes they're created dynamically so i want something which automatically excludes tage pages from being crawled and indexed. Any suggestions? Cheers, Mark
Intermediate & Advanced SEO | | monster990 -
Another E-commerce Canonical Question
Hi guys, Quick question: one of our clients has an e-commerce site with a very poor canonical tag setup and thousands of pages of duplicate content. Let's use this as an example: BRAND > Category > Type > Color
Intermediate & Advanced SEO | | elcrazyhorse
Four separate pages/URLs. The BRAND page lists all products.
The Category page lists all BRAND products for that category.
The Type page lists all BRAND products of a specific type in that category.
The Color page lists all BRAND products of a specific type in that category of a specific color. Anyway, these generate four separate URLs: /BRAND
/BRAND/Category
/BRAND/Category-Type
/BRAND/Category-Type-Color Avoiding duplicate content and product listings, I would appreciate your proposed canonicalization strategy/feedback.0 -
Is this structure valid for a canonical tag?
Working on a site, and noticed their canonical tags follow the structure: //www.domain.com/article They cited their reason for this as http://www.ietf.org/rfc/rfc3986.txt. Does anyone know if Google will recognize this as a valid canonical? Are there any issues with using this as a the canonical?
Intermediate & Advanced SEO | | nicole.healthline0 -
Do links script tags pass value?
Hi I was wondering if there was any consensus over whether links in script tags pass any value - such as the link code below? Thanks
Intermediate & Advanced SEO | | James770 -
Usage of HTTP Status Code 303
Hello, is there anybody who has got some experience with 303 HTTP Status Code? Our software development would like to use 303 "See Others" instead of 301 for redirecting old product-links to the site-root, instead of showing 404 errors. What is the best practise for redirecting old product links which are gone in online-shop context? Best regards Steffen
Intermediate & Advanced SEO | | steffen_0