Support » Plugin: All in One SEO Pack » Canonical Link Trailing Slash Missing for Homepage

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Peter Baylies



    The canonical link should be set to the permalink for the page in question; is this not working for you? What is your website and how do you have your home or front page set up?

    This is an issue with permalinks set as Post name (most popular) on several sites, but I’d imagine it exists regardless for all permalink options.

    This isn’t an isolated issue, this is a universal problem with WordPress canonicalization that has effected many canonicalization plugins for years now. It often goes overlooked because most people don’t see the issue as it’s under the hood.

    The problem is that the site URL is set as:

    Without the trailing slash because all permalinks, folder images, etc provide their own beginning slash to complete the URL:


    So, you’d have a proper canonicalization of:

    But, for the homepage, when you request:

    <?php get_site_url(); ?>


    <?php echo site_url(); ?>


    <?php bloginfo('wpurl'); ?>

    Or whatever, it just outputs – which for all other purposes is perfect for WP needs, but in the case of canonicalization, is erroneous.

    So, basically, just a simple is_home or similar conditional is needed to incorporate the trailing slash when needed.


    Plugin Contributor Peter Baylies



    So basically what you’re saying is that instead of using the home option or home_url() function, you’d like to see this default to home_url(‘/’) when is_home() is true (and not using a static front page). I think this is correct and I’ll see if we can implement this, or if there are any circumstances where this wouldn’t be desirable. In the meantime, though, you can do this on your site with the aioseop_canonical_url filter.

    Yeah, it’s strictly a root URL issue based on either the WordPress Address (URL) or Site Address (URL) settings, or both.

    One variable to keep a lookout for is probably when people setup in a sub-directly instead of the root like:

    And the like.

    I’m not a programmer, so that’s probably as helpful as I can be for this issue.

    Thanks for looking into this.

    I have this exact same issue. My site is at /blog/ but the canonical is /blog. This is a huge issue for Facebook in particular because it doesn’t follow 301 redirects so people trying to share /blog/ fail when the Facebook crawler hits it and sees /blog as the canonical and then crawls /blog for the contents of the post which then gives nothing.

    I’ve temporarily fixed this by rewriting the page at the load balancer, but I’ll guess that’s not something most people can do or know how to do 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Canonical Link Trailing Slash Missing for Homepage’ is closed to new replies.