Trailing slash redirect ?

#23497
  • Resolved Paul
    Rank Math free

    Hi,
    thanks for the plugin !

    I have some 2 versions of all posts : with trailing slash and without it.
    The one with has a canonical which is good but I would prefer to have a 301 redirect to the post without the trailing slash.
    Is there a proper way to do this through the plugin ? Through .htaccess ? Other ?

    Thx !

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math today.

    Yes you can make use of a .htaccess redirect to remove all training slashes from the URL. Here is an article that might be able to help.

    Looking forward to helping you. Thank you.

    ​​​​​​

    Paul
    Rank Math free

    Hello,
    thank you for your answer.

    I tried to apply this but it redirects to http version, not https.
    I therefore adapted it a bit to :

    RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule ^(.*)/$ /$1 [R=301,L]
    RewriteRule ^(.*)/$ https://example.com/$1 [L,R=301]
    • This reply was modified 5 years ago by Paul.
    Michael Davis
    Rank Math pro

    Hello,

    Thank you for contacting Rank Math today.

    I am glad that this is now resolved, we really appreciate that you shared the working directives 🙂

    Looking forward to helping you. Thank you.

    ​​​​​​

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

The ticket ‘Trailing slash redirect ?’ is closed to new replies.