You always need to generate your links and URLs. Hardcoded ones are a really bad habit. Coming from a Symfony environment, I’m familiar with $router->generate('my-route') but how does it work in PrestaShop? It turns out there are 2 ways depending on either you’re generating a frontend or a backend link.

Generate a Frontend URL

Generate a Backend URL

// Generic
$this->context->link->getAdminLink($this->controller_name) // from an AdminController

// Objects
// link to view a Customer
// link to update a Category
// link to update an Employee

// Modules
// go to a module config page
// go to a module config page, from the module itself

How to redirect

See this article on how to redirect in Prestashop