Canonical tag for home pages missing trailing slash

  • Hi,

    When switching on RankMath the canonical tags for the home pages (its a multisite setup) change from ending with a trailing slash to ending without a trailing slash.

    This is causing issues, as the non-trailing slash URLs redirect to trailing slash, as per usual WordPress behavior.

    Without Rankmath installed the canonicals correctly end with a trailing slash, as they do when using other SEO plugins to.

    Thanks

Viewing 15 replies - 1 through 15 (of 20 total)
  • Hi There,

    We might need to take a closer look at the settings. Please edit the first post on this ticket and include your WP logins in the designated Sensitive Data section.
    Sensitive Data Section

    It is completely secure and only our support staff has access to that section. If you want, you can use the below plugin to generate a temporary login URL to your website and share that with us instead:

    Temporary Login Without Password

    You can use the above plugin in conjunction with the WP Security Audit Log to monitor what changes our staff might make on your website (if any):

    WP Security Audit Log

    We really look forward to helping you.

    I reported a similar issue some time ago. https://support.rankmath.com/ticket/polylang-pro-rankmath-support/ it’s not an issue with this specific website. RankMath is really missing the trailing slash on the homepage url.

    Hello,

    Thank you for contacting Rank Math and thanks for the follow-up.

    Kindly allow me to consult the dev team on this and then I’ll get back to you.

    Looking forward to helping you. Thank you.

    ​​​​​​​

    Hi Michael, what email address should I use for the temporary login access?

    Hello Max,

    You do not need an email ID. You can follow the instructions we provided above to create a temporary login link. Then, add that URL in the sensitive data section so we can check.

    We look forward to helping you.

    Hi Tod,

    Temporary Login Without Password plugin requests an email address when creating a temporary login

    Hi Max,

    Please enter @rankmath.com">support@rankmath.com

    Do ping us once that is done.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

    You may also want to look into this issue at the same time:

    Author archives noindex not applying

    Hello,

    I’ve forwarded this issue to our Development Team, they will further debug this issue and release an update soon.

    For now, to fix the issue on your site, please add below filter code in your theme’s functions.php file:

    
    add_filter( 'rank_math/frontend/canonical', function( $canonical ) {
    	if ( is_home() ) {
    		return user_trailingslashit( $canonical );
    	}
    	return $canonical;
    });
    
    

    I hope that helps. Thank you.

    Thanks Pratik.

    However, rather than edit my themes functions.php files, I use this plugin to add code in the functions.php: https://wordpress.org/plugins/code-snippets/

    If I add this code as is via this plugin, will it work, or is some further code needed?

    Hello,

    Thank you for the follow-up.

    Yes, the code should work just fine. Kindly test it out and let me know.

    Hope this helps.
    ​​​​​​

    I’ve added the code Micheal, but the canonical tag is still missing the trailing slash.

    Hello,

    On my setup, the code is working fine. Can you give us read and write access to the theme’s functions.php file? We can check and fix the issue for you.

    Looking forward to helping you. Thank you.

    Hello,

    I have updated the sensitive data as requested. Can you please check further?

    Thank you.

Viewing 15 replies - 1 through 15 (of 20 total)

The ticket ‘Canonical tag for home pages missing trailing slash’ is closed to new replies.