The Moz Q&A Forum

    • Forum
    • Questions
    • My Q&A
    • Users
    • Ask the Community

    Welcome to the Q&A Forum

    Browse the forum for helpful insights and fresh discussions about all things SEO.

    1. SEO and Digital Marketing Q&A Forum
    2. Categories
    3. Intermediate & Advanced SEO
    4. HTTP Header Canonical Tags

    HTTP Header Canonical Tags

    Intermediate & Advanced SEO
    2 1 271
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as question
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • AndrewAkesson
      AndrewAkesson last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • AndrewAkesson
        AndrewAkesson last edited by

        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'.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        • Canonical Tags increased after putting the appropriate tag?
          MattRoney
          MattRoney
          0
          4
          50

        • Canonical Tag help
          MattRoney
          MattRoney
          0
          5
          124

        • Which is the better solution to remove URLs from search?meta noindex tag or 410 http header status?
          irvingw
          irvingw
          0
          4
          138

        • Canonical URL Tag
          MoosaHemani
          MoosaHemani
          0
          5
          86

        • Canonical tag
          KarlBantleman
          KarlBantleman
          0
          11
          315

        • Canonical tag usage.
          Debdulal
          Debdulal
          0
          6
          1.0k

        • Does Bing support rel="canonical" HTTP Headers?
          Dr-Pete
          Dr-Pete
          0
          8
          2.6k

        • Help with canonical tag
          RyanKent
          RyanKent
          0
          5
          759

        Get started with Moz Pro!

        Unlock the power of advanced SEO tools and data-driven insights.

        Start my free trial
        Products
        • Moz Pro
        • Moz Local
        • Moz API
        • Moz Data
        • STAT
        • Product Updates
        Moz Solutions
        • SMB Solutions
        • Agency Solutions
        • Enterprise Solutions
        • Digital Marketers
        Free SEO Tools
        • Domain Authority Checker
        • Link Explorer
        • Keyword Explorer
        • Competitive Research
        • Brand Authority Checker
        • Local Citation Checker
        • MozBar Extension
        • MozCast
        Resources
        • Blog
        • SEO Learning Center
        • Help Hub
        • Beginner's Guide to SEO
        • How-to Guides
        • Moz Academy
        • API Docs
        About Moz
        • About
        • Team
        • Careers
        • Contact
        Why Moz
        • Case Studies
        • Testimonials
        Get Involved
        • Become an Affiliate
        • MozCon
        • Webinars
        • Practical Marketer Series
        • MozPod
        Connect with us

        Contact the Help team

        Join our newsletter
        Moz logo
        © 2021 - 2026 SEOMoz, Inc., a Ziff Davis company. All rights reserved. Moz is a registered trademark of SEOMoz, Inc.
        • Accessibility
        • Terms of Use
        • Privacy