How do i give a trailing slash to:

RewriteEngine on
RewriteRule !\.(js|ico|gif|jpg|png|css|html)$ index.php

I've attempted with:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+[^/])$ $1/ [R]

But it is no longer working

Begin to see the detail/description line for that CondPatterns -d and -f for RewriteCond. Observe how it states "tests whether it is available, and it is a normal file"? That's costly and doesn't scale well whatsoever. You may not care whether it's "a normal file"? No, you simply care whether it looks just like a file. (matches the filename.extension pattern) So, I am likely to enhance your Rewrite while I am in internet marketing.

Begin to see the detail/description for that 'lastL' flag for RewriteRule. Observe how it states "don't apply anymore rewrite rules"? I wager that's what you would like is not it? You would like either index.php for use whenever a request does not match the extension of the static resource, OR you need to put a slash around the finish of the request that does not match the filename.extension pattern. Not both.

Here's how you accomplish that:

# turn on matching
RewriteEngine on

# 1st rule block. If any of the conditions don't apply skip over this block to the next.
# condition: uri ends with filename.extension
RewriteCond %{REQUEST_URI}  [^/.]+\.[^/.]+$
# condition: uri doesn't end with a desired extension
RewriteCond %{REQUEST_URI}  !\.(js|ico|gif|jpg|png|css|html)$ [NC]
# rewrite the request to be for index.php and don't apply any more rules
RewriteRule -  index.php [L]

# 2nd rule block. If any of the conditions don't apply skip over this block to the next.
# condition: uri doesn't end with a slash
RewriteCond %{REQUEST_URI}  !/$
# condition: uri doesn't end with filename.extension
RewriteCond %{REQUEST_URI}  !/[^/.]+\.[^/.]+$
# rewrite the request to be appended with a slash
RewriteRule (.*)  $1/ [R=301]

This can be a excellent answer thinking about that you simply did not inform us want you are attempting to complete. If you prefer a better answer, you will need to provide us with more information than "I replicated and copied and pasted 2 code snipets together, but it is no longer working.Inch