5

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?

4

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

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.