URL with and without / doesn’t redirect

#518786
Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello,

    Thank you for contacting Rank Math and bringing your concern to our attention. I’m sorry for any inconvenience this issue may have caused you.

    Those pages are loading without the trailing slash, but the canonical has a trailing slash making their different pages and hence, the error reported by Google.

    ​​​​​​​You need to make sure that the page URL and the canonical match exactly, and in this case, you could create a redirection to force the trailing slash into the URLs.

    Unfortunately, Rank Math’s redirection could not handle this type of redirect. You may need to add a code to your .htaccess file similar to this to redirect/force the non-trailing slash URLs of your site:

    # Force trailing slash
    <IfModule mod_rewrite.c>
    	RewriteCond %{REQUEST_URI} /+[^\.]+$ 
    	RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]
    </IfModule>

    Or this one:

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*[^/])$ /$1/ [L,R=307]

    Please take a backup of your .htaccess file before editing.

    We highly recommend getting in touch with your web host for assistance in modifying your .htaccess file to ensure that the code is working properly and to avoid any unexpected issues on your site.

    Hope that helps.

    Thank you.

    Matteo
    Rank Math free

    Thank you, how you discover that URL is loaded without trailing slash? The code of the articles links is with “/” in the URL.

    Thank you again

    Hello,

    From the link you have shared, this URL structure is opening fine without the trailing slash at the end:
    https://housetohomestaging.it/la-funzione-del-design-guida-paradossale-per-auto-discolparci

    I’ve also checked the other posts in your sitemap, and they are opening fine as well without trailing slash.

    Hope that helps.

    Thank you.

    Matteo
    Rank Math free

    Yes, this is the question. Rank math doesn’t redirect automatically this URLS? this can happen on every website

    Hello,

    Yes, Rank Math does not have a feature to redirect the trailing slash version, as it should be done via your server or .htaccess as I’ve mentioned above.

    Looking forward to helping you.

    Thank you.

    Matteo
    Rank Math free

    Thank you Reinelle, very helpful

    Hello,

    Glad that helped.

    Please feel free to reach out to us again in case you need any other assistance.

    We are here to help.

    Thank you.

Viewing 7 replies - 1 through 7 (of 7 total)

The ticket ‘URL with and without / doesn’t redirect’ is closed to new replies.