A Metalsmith plugin to create an Apache HTTP Server .htaccess
configuration file.
npm install --save metalsmith-htaccess
import Metalsmith from 'metalsmith';
import htaccess from 'metalsmith-htaccess';
Metalsmith(__dirname)
.use(htaccess({
// options here
}))
.build((err) => {
if (err) {
throw err;
}
});
Type: string
Default: "utf-8"
Sets AddDefaultCharset
.
Type: boolean
Default: false
Enables or disables ServerSignature
.
Type: object
An object of ErrorDocument
s, example:
{
"core": {
"errorDocuments": {
"401": "/error_pages/401.html",
"404": "/error_pages/404.html",
"500": "/error_pages/500.html"
}
}
}
Type: boolean
Default: true
Enables or disables FollowSymlinks
.
Type: boolean
Default: false
Enables or disables Indexes
.
Type: boolean
Default: false
Enables or disables MultiViews
.
Type: string[]
Default: ["image/svg+xml", "application/javascript", "application/rss+xml", "application/vnd.ms-fontobject", "application/x-font", "application/x-font-opentype", "application/x-font-otf", "application/x-font-truetype", "application/x-font-ttf", "application/x-javascript", "application/xhtml+xml", "application/xml", "font/opentype", "font/otf", "font/ttf", "image/x-icon", "text/css", "text/html", "text/javascript", "text/plain", "text/xml"]
A list of MIME types to AddOutputFilterByType DEFLATE
.
Type: string
Default: "index.html index.htm index.php index.cgi"
Set DirectoryIndex
.
Type: string
Set SetEnv SERVER_ADMIN
.
Type: string
Set SetEnv TZ
.
Type: string
Default: "access plus 2 days"
Set ExpiresDefault
.
Type: object
Default:
{
"image/jpg": "access plus 1 month",
"image/svg+xml": "access 1 month",
"image/gif": "access plus 1 month",
"image/jpeg": "access plus 1 month",
"image/png": "access plus 1 month",
"text/css": "access plus 1 month",
"text/javascript": "access plus 1 month",
"application/javascript": "access plus 1 month",
"application/x-shockwave-flash": "access plus 1 month",
"image/ico": "access plus 1 month",
"image/x-icon": "access plus 1 month",
"text/html": "access plus 600 seconds"
}
Set ExpiresByType
.
Type: boolean
Enables or disables mod_gzip_can_negotiate
.
Type: boolean
Enables or disables mod_gzip_dechunk
.
Type: string[]
A list of mod_gzip_item_include
.
Type: string[]
A list of mod_gzip_item_exclude
.
Type: boolean
Default: false
Enables or disables ETag header.
Type: string
Sets DefaultLanguage
.
Type: object
An object of AddLanguage
s, example:
{
"mime": {
"languages": {
"en": "en",
"en-gb": ".en",
"en-us": ".en"
}
}
}
Type: object
An object of AddCharset
s, example:
{
"mime": {
"charsets": {
"EUC-JP": ".euc",
"ISO-2022-JP": ".jis",
"SHIFT_JIS": ".sjis"
}
}
}
Type: object
An object of AddType
s, example:
{
"mime": {
"types": {
"image/gif": ".gif",
"image/jpeg": "jpeg jpg jpe"
}
}
}
Type: string
Sets the 404 redirect page.
Type: string
Default: "Inherit"
Sets RewriteOptions
.
Type: string[]
A list of allowed HTTP methods.
Type: boolean
Enable HTTPS redirection.
Type: boolean
Enables or disables CheckSpelling
.