1
0
mirror of https://github.com/astaxie/beego.git synced 2024-06-14 05:33:34 +00:00

autorouter when /admin 301 to /admin/

This commit is contained in:
astaxie 2013-08-04 23:13:29 +08:00
parent 3d481178d7
commit fd3c8834da

View File

@ -544,6 +544,12 @@ func (p *ControllerRegistor) ServeHTTP(rw http.ResponseWriter, r *http.Request)
if !findrouter {
for cName, methodmap := range p.autoRouter {
if strings.ToLower(requestPath) == "/"+cName {
http.Redirect(w, r, requestPath+"/", 301)
return
}
if strings.ToLower(requestPath) == "/"+cName+"/" {
requestPath = requestPath + "index"
}