Sign in

Index.html not redirecting to root

  • This topic has 3 replies, 3 voices, and was last updated 1 year, 4 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #7693
    Avatar photoritesh


    I’m using Netlify.

    Currently, all the pages on the site are accessible with and without index.html at the end of the URL.

    I turned on pretty URLs, but that didn’t work.

    I then added this code:

    from = "/*/index.html"
    to = "/:splat:"
    status = 200
    force = false

    Even that’s not working. If I add true to force, it shows a 404 error, but it won’t strip index.html off of the URLs.

    What should I do?

    Avatar photodeepvyas

    Hope this .htaccess rule may solve your problem

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME}/index.html !-f
    RewriteCond %{REQUEST_FILENAME}/index.php !-f
    RewriteCond %{HTTPS} on
    RewriteCond %{HTTP_HOST} !^
    RewriteRule . index.php [L]

    Avatar photoritesh

    Hey, thanks for the snippet. I’ve tried it, but unfortunately, it didn’t work.

    Avatar photoTomasz Dziuda


    It is due nature of static websites – even if you are using pretty URLs, Publii will generate directory where index.html exists – so both URLs will work:



    Unfortunately the only way to handle this is server configuration which will redirect index.html to the directory path.

    .htaccess won’t work on Netlify, in fact it seems to be problematic to achieve on Netlify, maybe please try such config:

      from = "/:slug/index.html"
      to = "/:slug/"
      status = 200
      force = false


    Do you appreciate the support you've received today? If so, consider donating to the Publii team by clicking here; we'll be sure to use your donation to make Publii even better!

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.