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
-
Changing title tags - any potential issues?
Hello all, I am planning to change the title tags throughout a site and am vaguely aware (perhaps wrongly!) that changing title tags across a site is a risk factor - can be a spam flag if changes (to a specific title tag) are implemented too regularly, for example. Would you change title tags across a site in one go, or implement changes gradually - to avoid any risk of upsetting Google. Do you have any insights/tips on the implementation of title tag changes?
Intermediate & Advanced SEO | | McTaggart1 -
Original Source Tag or Canonical Tag for News Publishers?
I have been sourcing content from a news publisher who is my partner for publishing content online. My website deals with sourcing content from a couple of websites. I did use a canonical tag pointing towards the respective syndicated source but I have not seen traffic for those articles. I did some research and found out that Google does have a tag for news publishers which is the "original-source" tag which helps news publishers to give proper credit for their work. Here's a link to the official word by Google" https://news.googleblog.com/2010/11/credit-where-credit-is-due.html Although Google has officially stated that the "syndication-source" tag has been replaced by the "canonical" tag. However, there is no mention about the "original-source" tag.
Intermediate & Advanced SEO | | Starcom_Search
Can I still use the "original-source" tag to syndicate content from my partner site instead of the "canonical" tag? P.S.: The reason why I am not convinced with the use of the canonical tag is because:
1. As per what Google says, duplicate content won't harm my website unless it is spam. (And since we are rightfully content from our partner'website and showcasing it to a larger audience by hosting it on our website as well, we are thereby not indulging in any unethical practices) 2. The canonical tag could possibly hamper my crawl bandwidth issues as it would essentially need the crawler to crawl the whole page to figure out that the canonical is present, post which any possible valuation that my site could have garnered gets lost.3. Moreover, since I am from the news, media and publication industry, content republication is a widely accepted practice and in such cases simply including a link to the original source of the article or using the original source tag should suffice, That being mentioned, I do not want to go ahead without taking a second opinion about this. Kindly help me to resolve this issue.0 -
Canonical vs 301 - Web Development
So I'm having a conversation with the development team at my work and I'm a little tired today so I thought I would ask for other opinions. The currently the site duplicates it's full site by having a 200 show with or without a trailing slash. I have asked for a 301 redirect to with the trailing slash. They countered with having all the rel=canonical be the trailing slash, which I know is acceptable. My issue is that while a rel=canonical is acceptable, since my site has a very high level of competition and a very aggressive link building strategy, I believe that it may be beneficial to have the 301 redirect. BUT, I may be wrong. When we're talking hundreds of thousands of links, I would love to have them directly linked instead of possibly splitting them up between a duplicate page that has a correct canonical. I'm curious to what everyone thinks though....
Intermediate & Advanced SEO | | mattdinbrooklyn1 -
Canonical code set up correctly?
Please let me know if this makes sense. I have a very limited knowledge of technical SEO but I am almost positive that my web developer did something wrong. I have a wordpress blog and he did add canonical code to some of the pages. However he directs the site to the same URL! Does this mean that the canonical code is setup incorrectly and actually harming my SEO performance. Also if I have one webpage with just the first paragraph of a blog post I wrote and a completely seperate page for the blog post itself, could this be considered duplicate content? Thanks!!
Intermediate & Advanced SEO | | DR700950 -
Appropriate Use of Canonical Tag
Hello, I am creating study guides for books with tabbed elements for each study guide. For example, for Othello, I'd have 3 tabs like so: 1. Overview page = xyz.com/othello 2. Context = xyz.com/othello/context 3. Characters = xyz.com/othello/characters I noticed that YouTube channels have tabbed elements and use the canonical. For example, all of the tabbed sections on https://www.youtube.com/user/Nerdist/channels have this canonical http://www.youtube.com/user/Nerdist"> In my case, would it be a correct use of the canonical tag to include rel="canonical" href = http://xyz.com/othello on each of the tabbed pages? Also, where exactly in the header should the canonical be placed? Before or after open graph / twitter cards?
Intermediate & Advanced SEO | | stageagent0 -
HTTP Errors in Webmaster Tools
We recently added a 301 redirect from our non-www domain to the www version. As a result, we now have tons of HTTP errors (403s to be exact) in Webmaster Tools. They're all from over a month ago, but they still show up. How can we fix this?
Intermediate & Advanced SEO | | kylesuss0 -
Canonical tag vs 301
What is the reason that 301 is preferred and not rel canonical tag when it comes to implementing redirect. Page rank will be lost in both cases. So, why prefer one over the other ?
Intermediate & Advanced SEO | | seoug_20050 -
Most effective Title Tag Structure
I want to target a set of keywords but I want to know which type of Title tag structure or wording is most effective? Here are my target keywords: CMMS, CMMS Software, EAM Software, Maintenance Management Software Do you think using exact keywords terms are most effective? For example: Title tag: CMMS, CMMS Software, EAM Software, Maintenance Management Software Or: Title tag: CMMS Software, EAM Maintenance Management Software Same goes for keyword use for content and H1 tags. Your thoughts? Thanks, John
Intermediate & Advanced SEO | | VizionSEO990