Fix rewrite regex to match the start of the URL and not a substring

This commit is contained in:
Manuel de Brito Fontes 2017-02-17 10:38:52 -03:00
parent b5819d8f4d
commit 77221b3555
2 changed files with 8 additions and 5 deletions

View file

@ -237,7 +237,10 @@ func buildLocation(input interface{}) string {
path := location.Path
if len(location.Redirect.Target) > 0 && location.Redirect.Target != path {
return fmt.Sprintf("~* %s", path)
if path == "/" {
return fmt.Sprintf("~* %s", path)
}
return fmt.Sprintf("~* ^%s", path)
}
return path