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
-
Relationship Between Cross-Domain Canonical Versions and Backlinks
Hi All, I am looking for some community insight on how backlinks on the different versions of a canonical page are handled for ranking purposes. Suppose that I have two versions of the same page on two different domains: 1. https://www.mysite.com/tshirts <--Canonical Version 2. https://www.mywebsite.com/tshirts <--Non-Canonical Version that points to page #1 Also consider a third domain that is being linked to from the article. Since it is identical content, both pages contain the same outbound links to this page: 3. https://www.myclothing.com I am wondering how the backlink authority transfer is handled for page number two. Since it has the canonical tag pointing to page 1, only page 1 should be considered for indexing/ranking purposes as a whole page. However, my question relates to what happens to backlink flow since both #1 and #2 above contain links to site #3. In the above example, would both mysite.com and mywebsite.com be passing a backlink to myclothing .com, or would it only be the first domain (www.mysite.com) passing link authority since it is marked as the canonical for ranking purposes. Thanks for any thoughts!
Intermediate & Advanced SEO | | Evan_Wright0 -
Canonical tag on a large site
when would you reccomend using a canonical tag on a large site?
Intermediate & Advanced SEO | | Cristiana.Solinas0 -
Http to https what should one look out for
Hi, we are moving our site from http to https and would like to know what should one look out for. What are the things that can go wrong, and what is the best way to go about it. Regards Tai
Intermediate & Advanced SEO | | Taiger0 -
Changing Canonical Tags on Indexed Pages that are Ranking Well
Hi Guys, I recently rolled out a domain wide canonical tag change. Previously the website had canonical tags without the www, however the website was setup to redirect to www on page load. I noticed that the site competitors were all using www and as far as I understand www versus non www, it's based on preference. In order to keep things consistent, I changed the canonical tag to include the www. Will the site drop in rankings? Especially if the pages are starting to rank quite well. Any feedback is appreciated. Thanks!
Intermediate & Advanced SEO | | QuickToImpress0 -
Ecommerce SEO: Title Tags for pagination
Here's a specific question about title tags for ecommerce website... We've got lists of products (category list pages) that stretch for many pages... is there any benefit to added a something to make the title tag unique. For example: Page 1: <title></span><span class="html-tag" data-mce-mark="1">Category List Page Example</span><span class="html-tag" data-mce-mark="1"></title> Page 2: <title></span><span class="html-tag" data-mce-mark="1">Category List Page Example - Page 2</span><span class="html-tag" data-mce-mark="1"></title> Page 3: <title></span><span class="html-tag" data-mce-mark="1">Category List Page Example - Page 3</span><span class="html-tag" data-mce-mark="1"></title> FWIW, we've got the pagination and canonicalization nailed down tight. Moz crawl actual brought a dupe content issue based on title tags.
Intermediate & Advanced SEO | | 19prince0 -
Use Nonindex or Canonical on product tags of a e-commerce site
I run a e-commerce site and we have many product tags. These product tags come up as "Duplicate Page Content" when Moz does it's crawl. I was wondering if I should use Nonindex or Canonical? The tags all go to the same product when used so I figure I would just nonindex them but was wondering what's the best for SEO?
Intermediate & Advanced SEO | | EmmettButler1 -
Rel="canonical" questions?
On our site we have some similar pages for example in our parts page we have the link to all the electrical parts you can see here http://www.rockymountainatvmc.com/c/43/53/160/Electrical and we have a very similar page going from our accessories page to electrical here http://www.rockymountainatvmc.com/c/43/72/221/Electrical We are thinking about putting rel="canonical" from the accessories electrical page to the parts one. We would do this for several pages not just this one. Thoughts???
Intermediate & Advanced SEO | | DoRM0 -
Is a 301 Direct with a canonical tag Possible ?
Hi All, Quick question , Are we correct in thinking that for any given URL it's not possible to do a 301 redirect AND a canonical tag? thanks Sarah
Intermediate & Advanced SEO | | SarahCollins0