6 .htaccess Rewrites: Remove index.html, Remove .html, Force non-www, Force Trailing Slash
<p>i've to give some information about my website Environment</p>

<ol>
<li><p>i have static webpage in the root.</p></li>
<li><p>Wordpress installed in sub-dictionary www.domain.com/blog/</p></li>
<li><p>I have two .htaccess , one in the root and one in the wordpress
folder.</p></li>
</ol>

<p>i want to </p>

<ul>
<li>www to non on all URLs <strong>&lt; below code DID it :)</strong></li>
<li>Remove index.html from url <strong>&lt; below code DID it :)</strong></li>
<li>Remove all .html extension / Re-direct 301 to url
without .html extension  <strong>&lt; below code DID it :)</strong></li>
<li>Add trailing slash to the static webpages / Re-direct 301 from non-trailing slash <strong>&lt;&lt; I NEED HELP WITH THAT</strong></li>
<li>Force trailing slash to the Wordpress Webpages / Re-direct 301 from non-trailing slash <strong>&lt; below code DID it :)</strong></li>
</ul>

<p>Some examples</p>

<p>domain.tld/index.html >> domain.tld/</p>

<p>domain.tld/file.html >> domain.tld/file/</p>

<p>domain.tld/file.html/ >> domain.tld/file/</p>

<p>domain.tld/wordpress/post-name >> domain.tld/wordpress/post-name/</p>

<p>My code in ROOT htaccess is</p>

<pre><code>    &lt;IfModule mod_rewrite.c&gt; 
    Options +FollowSymLinks -MultiViews


    RewriteEngine On 
    RewriteBase /

    #removing trailing slash
    RewriteCond %{REQUEST_FILENAME} !-d     
    RewriteRule ^(.*)/$ $1 [R=301,L]

    #www to non
    RewriteCond %{HTTP_HOST} ^www\.(([a-z0-9_]+\.)?domain\.com)$ [NC]
    RewriteRule .? http://%1%{REQUEST_URI} [R=301,L]

    #html
    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^([^\.]+)$ $1.html [NC,L]

    #index redirect 
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.html\ HTTP/ 
    RewriteRule ^index\.html$ http://domain.com/ [R=301,L]
    RewriteCond %{THE_REQUEST} \.html 
    RewriteRule ^(.*)\.html$ /$1 [R=301,L] 
    &lt;/IfModule&gt; 

    &lt;IfModule mod_rewrite.c&gt;
    RewriteEngine on
    RewriteBase /blog/
    # Force Trailing Slash for wordpress
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)[^/]{1}$ %{REQUEST_URI}/ [L,R=301]
    &lt;/IfModule&gt; 
</code></pre>

<p>The above code do</p>

<ol>
<li>redirect www to non-www</li>
<li>Remove trailing slash at the end (if exists)</li>
<li>Remove index.html</li>
<li>Remove all .html</li>
<li>Redirect 301 to filename without trailing slash at the end</li>
<li>Force Trailing Slash for wordpress and redirect 301 from non trailing slash at the end</li>
</ol>

<h2>EDIT</h2>

<pre><code>#removing trailing slash Rule usage
</code></pre>

<p><a href="https://i.stack.imgur.com/veK5z.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/veK5z.png" alt="removing trailing slash Rule"></a></p>