Browse Source

minor: 首页跳转问题

tuonian 3 weeks ago
parent
commit
f89be7506c
1 changed files with 10 additions and 1 deletions
  1. 10 1
      server/routers/router.go

+ 10 - 1
server/routers/router.go

@@ -78,8 +78,17 @@ func init() {
 	beego.Router(fmt.Sprintf("%s/config.js", config.ContextPath), &nginx_controller.ConfigController{})
 	// portal static assets
 	beego.SetStaticPath(config.ContextPath, "static/web")
+
+	webPrefix := config.ContextPath
+	if !strings.HasSuffix(webPrefix, "/") {
+		webPrefix = webPrefix + "/"
+	}
+
 	beego.Get("/", func(ctx *context.Context) {
-		ctx.Redirect(301, fmt.Sprintf("%s/index.html", config.ContextPath))
+		ctx.Redirect(301, webPrefix)
+	})
+	beego.Get(config.ContextPath+"/*", func(ctx *context.Context) {
+		ctx.Redirect(301, webPrefix)
 	})
 
 	beego.ErrorHandler("404", func(writer http.ResponseWriter, request *http.Request) {