1

Is there a static site generator (FLOSS and for GNU/Linux) that generates, in addition to the website, an .htaccess file for an Apache webserver?

With usual static site generators, I’d have to manually create/edit the .htaccess after the site gets generated. This is bothersome and easily leads to mistakes when adding new documents or changing URLs etc.

Ideally, it allows to configure everything in the front matter of each content file (I don’t want to have to edit a second file, otherwise I could edit the .htaccess directly in the first place).

A solution has not to support all of the following features:

URL rewrites

It would be fantastic if it automatically generates URL rewrites so that the URL specified in the front matter can be used.

(But I guess this would probably be too complex.)

HTTP response status codes

Especially 300, 301, 303, 404, and 410.

For example, when I want to 301-redirect /foo to /bar, I’d create a new document "foo" and specify in its front matter something like:

http-status: 301
http-location: bar

(It would be perfect it would always redirect to the current URL of the "bar" document.)

In case of 404 and 410, the document content should be displayed (i.e., it enables custom error pages). For example, I no longer want /foo:

http-status: 410

---

Sorry, I no longer do Foo. 

HTTP headers

For /foo, I could specify in its front matter something like:

http-header: 
  - Link: </foo.pdf>; rel="alternate"
  - Link: </foo.odt>; rel="alternate"

The specified headers should be sent whenever this file is shown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.