Using Craft's redirect template tag creates a redirect with a 302 (Moved Temporarily) http status code. How can I force a 301 (Moved Permanently) status code?


Although it is (as of today) not yet documented, looking through the redirect twig extension revealed that the redirect tag can accept a second parameter for the http status code. So forcing a 301 is done as follows:

{% redirect 'pricing' 301 %}

I've sent a request to P&T to add this to the docs.

Your Answer

