how to redirect with htaccess from url.com/folder/path/ to url.com/folder/path

Viewed 16

i need to remove the last / from all urls

whats is the .htaccess code why i need to use to: From this:

> alerta-estafa.com/numeros-de-telefono/699511414/

To this:

> alerta-estafa.com/numeros-de-telefono/699511414

How i can do it?

Thanks you!

1 Answers

Assuming these URLs don't map to physical directories.

Using mod_rewrite near the top of the .htaccess file:

RewriteEngine On

# Remove trailing slash from URL of the form "/<string>/<number>/"
RewriteRule ^([\w-]+/\d+)/$ /$1 [R=302,L]
Related