VirtualURIMapping is an interface, so you can create your own implementation to handle dynamic redirects.
You can also get a reference to the HttpServletResponse through MgnlContext.getWebContext().getResponse() and redirect by calling response.sendRedirect(redirectURL). I would recommend putting that logic in a model class instead of a template script. Nils. > Op 2 sep. 2015, om 16:19 heeft Mathias Lin (via Magnolia Forums) > <fo...@magnolia-cms.com> het volgende geschreven: > > I want to to a 301 permanent redirect via Freemarker template. > However, setting the status code is ignored, the redirect still always > redirects with a 302 code ("temporarily moved"). > > This is the code: > > [code] > ${ctx.response.setStatus(301)} > ${ctx.response.sendRedirect("${content.externalLink}")} > [/code] > > I know I could use VirtualURIMapping and the "permanent:" directive, but I > need to redirect dynamically to editable URLs set by authors. > > (I'm on Magnolia 5.4.1 CE). ---------------------------------------------------------------- For list details, see http://www.magnolia-cms.com/community/mailing-lists.html Alternatively, use our forums: http://forum.magnolia-cms.com/ To unsubscribe, E-mail to: <user-list-unsubscr...@magnolia-cms.com> ----------------------------------------------------------------