Non-slash to slash URLs redirect

Hello, community!

Can anyone help me to configure an URL forwarding rule which will redirect:

https://www.example.com/directory/url
to
https://www.example.com/directory/url/

But won’t touch images and other files like .jpg, .pdf, etc…

Thanks in advance!

Does it have to be a redirect? Or can it be a rewrite that just gets sent to your server? If a rewrite is ok, you can try a Transform rule:
https://developers.cloudflare.com/rules/transform

Not sure I understand the difference.

Usually SEOs (me including) use 301 redirect for that purpose, which I had in my .htaccess but it stopped working once I switched to CloudFlare for some reason (or maybe because of something else I’m not aware).

The .htaccess rule I had is:

RewriteEngine on
RewriteCond %{REQUEST_URI} /+[^\.]+$
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L]

Still need a solution :pensive:

Please advise

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.