Skip to content

Plain text _header and _redirect Netlify config files are being saved as index.html files #138

@sr293

Description

@sr293

When including a plain text config file with no extension for compatible services (Netlify, Gitlab Pages, Cloudfront Pages, etc.) the file is being treated like an HTML page which is producing an incorrect filename.

Example:
~/_redirects gets changed to ~/_redirects/index.html

It appears to be treated like an HTML page endpoint and not a file. When a file extension is present, like on ~/robots.txt, the generated file works as expected.

Steps to replication:

  1. Create a WordPress site and install the simply-static plugin
  2. Add a plain text file called _redirects with any text content to your document root so that it's visible at example.com/_redirects (example file)
  3. Include the _redirects URL in the simply static includes list in /wp-admin/
  4. Generate a static site
  5. The generated site will save the file as _redirects/index.html instead of _redirects, and because of the changed filename, the file won't be recognized as a configuration file by platforms like Netlify, Gitlab pages, etc.

The redirect file in root with no file extension:
image

Generated folder and index.html from file:
image

Site info from test site:
siteinfo.txt

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions