autorouter when /admin 301 to /admin/
Showing
1 changed file
with
6 additions
and
0 deletions
| ... | @@ -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 | } | ... | ... |
-
Please register or sign in to post a comment