title: Remove all .html in url string with .htaccess
body: <p>I want to remove all the &quot;.html&quot; (of url) for <strong>each path of my website</strong>. With the querys etc... So if I've file <a href="https://exemple.com/login.html" rel="nofollow noreferrer">https://exemple.com/login.html</a>, I want to only access it by <a href="https://exemple.com/login" rel="nofollow noreferrer">https://exemple.com/login</a>.</p>
  <p>I have seen several similar answers on stackoverflow. Except that after each test, they do not work.
  But, it doesnt work.</p>
  <p>This is my code actualy :</p>
  <pre class="lang-sh prettyprint-override"><code>#remove html file extension-e.g. https://example.com/file.html will become https://example.com/file
  RewriteEngine on 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME}\.html -f
  RewriteRule ^(.*)\.html$ /$1 [L,R=301]
  </code></pre>
  <p>AND</p>
  <pre class="lang-sh prettyprint-override"><code>#remove html file extension-e.g. https://example.com/file.html will become https://example.com/file
  RewriteEngine on 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^([^\.]+)$ $1.html [NC,L]
  </code></pre>
  <p>The two above do not work.</p>
  <p>JUST, the next code works. But it only creates a simple redirect and the page is not displayed correctly (without content, we only receive the list of items in the directory managed by nginx) :</p>
  <pre class="lang-sh prettyprint-override"><code>#remove html file extension-e.g. https://example.com/file.html will become https://example.com/file
  RewriteEngine on 
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} -f
  RewriteRule ^/?(.*)\.html$ /$1 [L,R=301]
  </code></pre>
  <p>So how I can do that ?
  Is there documentation to properly use .htaccess ?</p>
  <p>Thanks you.</p>