NGINX remove .html extension
<p>So, I found an answer to removing the .html extension on my page, that works fine with this code:</p>

<pre><code>server {
    listen 80;
    server_name _;
    root /var/www/html/;
    index index.html;

    if (!-f "${request_filename}index.html") {
        rewrite ^/(.*)/$ /$1 permanent;
    }

    if ($request_uri ~* "/index.html") {
        rewrite (?i)^(.*)index\.html$ $1 permanent;
    }   

    if ($request_uri ~* ".html") {
        rewrite (?i)^(.*)/(.*)\.html $1/$2 permanent;
    }

    location / {
        try_files $uri.html $uri $uri/ /index.html;
    }
}
</code></pre>

<p>But if I open mypage.com it redirects me to mypage.com/index
<br>
Wouldn't this be fixed by declaring index.html as index? Any help is appreciated.</p>