Commit e6d6419a authored by astaxie's avatar astaxie

beego: static file support robots.txt

parent 6357c88d
......@@ -27,11 +27,14 @@ func serverStaticRouter(ctx *context.Context) {
if len(prefix) == 0 {
continue
}
if requestPath == "/favicon.ico" {
if requestPath == "/favicon.ico" || requestPath == "/robots.txt" {
file := path.Join(staticDir, requestPath)
if utils.FileExists(file) {
http.ServeFile(ctx.ResponseWriter, ctx.Request, file)
return
} else {
http.NotFound(ctx.ResponseWriter, ctx.Request)
return
}
}
if strings.HasPrefix(requestPath, prefix) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment