MadsonJr
MadsonJr

Reputation: 73

.htaccess rewriterule for folder

I'm trying to redirect using the link: http://www.mysite.com/af/2 to http://www.mysite.com/af/2/, but I can not perform this procedure, the link /af/#### corresponds to a user ID and is a folder.

You can accomplish this using .htaccess?

Upvotes: 0

Views: 56

Answers (1)

Sumurai8
Sumurai8

Reputation: 20737

A rule like the following will take care of that:

RewriteCond %{REQUEST_URI} !/$
RewriteRule ^ %{REQUEST_URI}/ [R=301,L]

The condition is to prevent urls that already end with a slash to match this rule. The rule will match everything ^ and redirect it to the same url with a slash behind it.

Upvotes: 1

Related Questions