Can't figure out a htaccess rule

1

I have this in my htaccess but can't figure out what its for. Because of the nature of rule, searching doesn't help either.

RewriteCond %{REQUEST_URI} !(/$|\.)
RewriteRule (.*) %{REQUEST_URI}/ [R=301]

Can anyone please explain what its for?

user1000156

Posted 2019-02-23T09:58:56.007

Reputation:

Answers

0

This means :

  • If it's not true (!) that either ((|)):

    • the URI ends with a slash (/$), or
    • the URI contains a point (\.),
  • Then append a slash to the URI (%{REQUEST_URI}/), and

  • Return the new URI to the client's browser with return code 301 ([R=301]), which means permanent redirect to the new URI, and which also tells the browser to display the new URI in the address bar.

harrymc

Posted 2019-02-23T09:58:56.007

Reputation: 306 093