mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
fix!: Redirect old /remote-nodes/logs
to /remote-nodes/id/{id}
#155
The old `/remote-nodes/logs/?node_id={id}` is not being used anymore and should be redirected to the new path: `/remote-nodes/id/{id}`. Remove the route once search engines result shows the new path
This commit is contained in:
parent
5fb88865d0
commit
2e31824910
2 changed files with 17 additions and 0 deletions
|
@ -13,6 +13,19 @@ import (
|
||||||
"github.com/gofiber/fiber/v2/middleware/adaptor"
|
"github.com/gofiber/fiber/v2/middleware/adaptor"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Redirect old `/remote-nodes/logs/?node_id={id}` path to `/remote-nodes/id/{id}`
|
||||||
|
//
|
||||||
|
// This is temporary handler to redirect old path to new one. Once search
|
||||||
|
// engine results updated to the new path, this handler should be removed.
|
||||||
|
func (s *fiberServer) redirectLogs(c *fiber.Ctx) error {
|
||||||
|
id := c.QueryInt("node_id", 0)
|
||||||
|
if id == 0 {
|
||||||
|
return c.Redirect("/remote-nodes", fiber.StatusMovedPermanently)
|
||||||
|
}
|
||||||
|
|
||||||
|
return c.Redirect(fmt.Sprintf("/remote-nodes/id/%d", id), fiber.StatusMovedPermanently)
|
||||||
|
}
|
||||||
|
|
||||||
// Render Home Page
|
// Render Home Page
|
||||||
func (s *fiberServer) homeHandler(c *fiber.Ctx) error {
|
func (s *fiberServer) homeHandler(c *fiber.Ctx) error {
|
||||||
p := views.Meta{
|
p := views.Meta{
|
||||||
|
|
|
@ -7,6 +7,10 @@ func (s *fiberServer) Routes() {
|
||||||
s.App.Get("/add-node", s.addNodeHandler)
|
s.App.Get("/add-node", s.addNodeHandler)
|
||||||
s.App.Put("/add-node", s.addNodeHandler)
|
s.App.Put("/add-node", s.addNodeHandler)
|
||||||
|
|
||||||
|
// This is temporary route to redirect old path to new one. Once search
|
||||||
|
// engine results updated to the new path, this route should be removed.
|
||||||
|
s.App.Get("/remote-nodes/logs", s.redirectLogs)
|
||||||
|
|
||||||
// V1 API routes
|
// V1 API routes
|
||||||
v1 := s.App.Group("/api/v1")
|
v1 := s.App.Group("/api/v1")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue