mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 23:01:28 +00:00
autorouter when /admin 301 to /admin/
This commit is contained in:
parent
3d481178d7
commit
fd3c8834da
@ -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"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user