Enonic version: 6.12
Hi. I was wondering if it is possible to intercept requests and send a 301 redirect response to the user, if the given request has a redirect url defined?
I am redesigning a site and want to redirect traffic from the old urls to the new, for SEO purposes.
You can create a response filter.
In this case your code will be executed after a page/service has been executed, but you can override the response: set a redirect status and remove the body.
You could also create an error handler to catch 404 errors for example, and redirect to another URL instead.
Ah! I can just return a different http code in the handle404 method. That would be perfect. Thanks.