What's the correct way of performing a server-side redirect in custom Concrete5 code (5.7+)?
How do I perform a redirect in Concrete 5.7?
1.3k Views Asked by Simon E. At
2
There are 2 best solutions below
0

I discovered this is the best way:
(new RedirectResponse('/URL-HERE'))->send(); // 302 temporary
(new RedirectResponse('/URL-HERE', 301))->send(); // 301 permanent
You should be able to call this from (almost) anywhere within the app and not worry about namespaces since it has an alias in /concrete/config/app.php
.
Another solution would be as follows:
or
Sidenote: The url provided must not be absolute. For example:
'/dashboard/reports/logs'