e6d6419a by astaxie

beego: static file support robots.txt

1 parent 6357c88d
...@@ -27,11 +27,14 @@ func serverStaticRouter(ctx *context.Context) { ...@@ -27,11 +27,14 @@ func serverStaticRouter(ctx *context.Context) {
27 if len(prefix) == 0 { 27 if len(prefix) == 0 {
28 continue 28 continue
29 } 29 }
30 if requestPath == "/favicon.ico" { 30 if requestPath == "/favicon.ico" || requestPath == "/robots.txt" {
31 file := path.Join(staticDir, requestPath) 31 file := path.Join(staticDir, requestPath)
32 if utils.FileExists(file) { 32 if utils.FileExists(file) {
33 http.ServeFile(ctx.ResponseWriter, ctx.Request, file) 33 http.ServeFile(ctx.ResponseWriter, ctx.Request, file)
34 return 34 return
35 } else {
36 http.NotFound(ctx.ResponseWriter, ctx.Request)
37 return
35 } 38 }
36 } 39 }
37 if strings.HasPrefix(requestPath, prefix) { 40 if strings.HasPrefix(requestPath, prefix) {
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!