aboutsummaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/web.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/cmd/web.go b/cmd/web.go
index 83dfca4e67..a5ebf259ea 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -364,6 +364,15 @@ func runWeb(*cli.Context) {
r.Any("/:reponame/*", ignSignInAndCsrf, repo.Http)
})
+ // robots.txt
+ m.Get("/robots.txt", func(ctx *middleware.Context) {
+ if setting.HasRobotsTxt {
+ ctx.ServeFile(path.Join(setting.CustomPath, "robots.txt"))
+ } else {
+ ctx.Error(404)
+ }
+ })
+
// Not found handler.
m.NotFound(routers.NotFound)