0

I need to redirect all URLs with a slash at the end to the corresponding URL without it. For example I need to redirect this URL:

domain.com/category/subcategory/

to this URL:

domain.com/category/subcategory

Or this URL:

domain.com/category/

to this URL:

domain.com/category

How can I do it with a .htaccess redirect rule? Is it possible?

Thanks!

eera5607
  • 305
  • 2
  • 8

1 Answers1

0
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)/$ /$1 [L,R=301]
eera5607
  • 305
  • 2
  • 8