Change route path¶ ↑
You can change the URL path of any Rodauth
route by overriding the corresponding *_route
method:
plugin :rodauth do enable :login, :logout, :create_account, :reset_password # Change login route to "/signin" login_route "signin" # Change redirect when login is required to "/signin" require_login_redirect { login_path } # Change create account route to "/register" create_account_route "register" # Change password reset request route to "/reset-password/request" reset_password_request_route "reset-password/request" end
If you want to add a prefix to all Rodauth
routes, you should use the prefix
setting:
plugin :rodauth do enable :login, :logout # Use /auth prefix to each Rodauth route prefix "/auth" end route do |r| r.on "auth" do # Serve Rodauth routes under the /auth branch of the routing tree r.rodauth end # ... end
There are cases where you may want to disable certain routes. For example, you may want to enable the create_account feature to allow creating admins, but only make it possible programmatically via internal requests. In this case, you should set the corresponding *_route
method to nil
:
plugin :rodauth, name: :admin do enable :create_account # disable the /create-account route create_account_route nil end