fd3c8834 by astaxie

autorouter when /admin 301 to /admin/

1 parent 3d481178
...@@ -544,6 +544,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request) ...@@ -544,6 +544,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
544 544
545 if !findrouter { 545 if !findrouter {
546 for cName, methodmap := range p.autoRouter { 546 for cName, methodmap := range p.autoRouter {
547
548 if strings.ToLower(requestPath) == "/"+cName {
549 http.Redirect(w, r, requestPath+"/", 301)
550 return
551 }
552
547 if strings.ToLower(requestPath) == "/"+cName+"/" { 553 if strings.ToLower(requestPath) == "/"+cName+"/" {
548 requestPath = requestPath + "index" 554 requestPath = requestPath + "index"
549 } 555 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!