fixed missing apache rewrite in root
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3573e23212
commit
4a9a3eec06
@ -76,6 +76,8 @@ func (node *TreeNode) ProcessContent() {
|
|||||||
curNavPath = ""
|
curNavPath = ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if node.root != node {
|
||||||
|
// write htaccess for rewrites, root will be written in WriteWebserverConfig()
|
||||||
goTo := node.Config.This.GoTo
|
goTo := node.Config.This.GoTo
|
||||||
if goTo != nil && *goTo != "" {
|
if goTo != nil && *goTo != "" {
|
||||||
goToFixed := *goTo
|
goToFixed := *goTo
|
||||||
@ -86,6 +88,7 @@ func (node *TreeNode) ProcessContent() {
|
|||||||
|
|
||||||
htaccessRedirect(node.OutputPath, goToFixed)
|
htaccessRedirect(node.OutputPath, goToFixed)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, file := range node.InputFiles {
|
for _, file := range node.InputFiles {
|
||||||
var input []byte
|
var input []byte
|
||||||
|
@ -3,6 +3,7 @@ package mark2web
|
|||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"gitbase.de/apairon/mark2web/pkg/helper"
|
"gitbase.de/apairon/mark2web/pkg/helper"
|
||||||
)
|
)
|
||||||
@ -22,10 +23,27 @@ RewriteRule ^$ %{REQUEST_URI}`+goTo+`/ [R,L]
|
|||||||
}
|
}
|
||||||
|
|
||||||
// WriteWebserverConfig build the config for pre compression and more
|
// WriteWebserverConfig build the config for pre compression and more
|
||||||
func WriteWebserverConfig() {
|
func (tree *TreeNode) WriteWebserverConfig() {
|
||||||
|
goTo := ""
|
||||||
|
if g := tree.Config.This.GoTo; g != nil && *g != "" {
|
||||||
|
goTo = strings.TrimPrefix(*g, "/")
|
||||||
|
}
|
||||||
|
|
||||||
switch Config.Webserver.Type {
|
switch Config.Webserver.Type {
|
||||||
case "apache":
|
case "apache":
|
||||||
configStr := `
|
configStr := `
|
||||||
|
RewriteEngine on
|
||||||
|
|
||||||
|
`
|
||||||
|
|
||||||
|
if goTo != "" {
|
||||||
|
configStr += `
|
||||||
|
RewriteRule ^$ %{REQUEST_URI}` + goTo + `/ [R,L]
|
||||||
|
|
||||||
|
`
|
||||||
|
}
|
||||||
|
|
||||||
|
configStr += `
|
||||||
AddCharset UTF-8 .html
|
AddCharset UTF-8 .html
|
||||||
AddCharset UTF-8 .json
|
AddCharset UTF-8 .json
|
||||||
AddCharset UTF-8 .js
|
AddCharset UTF-8 .js
|
||||||
@ -34,8 +52,6 @@ AddCharset UTF-8 .css
|
|||||||
RemoveLanguage .br
|
RemoveLanguage .br
|
||||||
|
|
||||||
<IfModule mod_headers.c>
|
<IfModule mod_headers.c>
|
||||||
|
|
||||||
RewriteEngine on
|
|
||||||
`
|
`
|
||||||
|
|
||||||
rewriteMacro := func(e, c, x, xx string) string {
|
rewriteMacro := func(e, c, x, xx string) string {
|
||||||
|
@ -10,7 +10,7 @@ func Run(inDir, outDir string, defaultPathConfig *PathConfig) {
|
|||||||
|
|
||||||
ProcessAssets()
|
ProcessAssets()
|
||||||
|
|
||||||
WriteWebserverConfig()
|
tree.WriteWebserverConfig()
|
||||||
|
|
||||||
Wait()
|
Wait()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user