gatsby-plugin-htaccess
Version:
gatsby-plugin-htaccess creates a customizable htaccess-file on build containing the most important default settings for performance and security.
13 lines (11 loc) • 329 B
JavaScript
const normaliseHost = (host) => `
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} !=${host}
RewriteRule (.*) %{ENV:PROTO}://${host}/$1 [R=301,L]
</IfModule>
`
const setHost = (content, host) => host
? content.replace('### NORMALIZE-HOST ###', normaliseHost(host))
: content
module.exports = setHost