Commit fd3c8834 authored by astaxie's avatar astaxie

autorouter when /admin 301 to /admin/

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)
if !findrouter { if !findrouter {
for cName, methodmap := range p.autoRouter { for cName, methodmap := range p.autoRouter {
if strings.ToLower(requestPath) == "/"+cName {
http.Redirect(w, r, requestPath+"/", 301)
return
}
if strings.ToLower(requestPath) == "/"+cName+"/" { if strings.ToLower(requestPath) == "/"+cName+"/" {
requestPath = requestPath + "index" requestPath = requestPath + "index"
} }
......
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