Bar at the end of url with . htaccess

Asked

Viewed 1,909 times

3

I need to add a bar (/) to the end of the url using . htaccess.

My current . htaccess is like this:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^dominio.com.br [NC]
RewriteRule ^(.*)$ http://www.dominio.com.br/$1 [L,R=301]
RewriteRule ^index\.html$ / [R=301,L]
RewriteRule ^([a-z0-9-]+)/?$ /$1.html [NC]
</IfModule>

Someone knows how to do it?

2 answers

2

Long live,

In my case I use so:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !\..+$
RewriteCond %{REQUEST_URI} !/$
RewriteRule (.*) /$1/ [R=301,L]

Hug ;)

0

Solved? If not, I use it like this:

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.