How to do Permanent Redirect in Masonite

71 Views Asked by At

I can redirect the user, it works but it has 302 status, how I can redirect a user and add 301 so it will be permanent redirect?

request.redirect('/dashboard') 
1

There are 1 best solutions below

0
Joseph Mancuso On BEST ANSWER

You can add the status you need as a status parameter:

request.redirect('/dashboard', status=301)

If using Masonite 2.2+ you can also create a Redirect route:

from masonite.routes import Redirect

ROUTES = [
    Redirect('/from', '/to', status=301)
]