In your application controller file app/controllers/application_controller.rb include the following private method:

class ApplicationController < ActionController::Base
  
  private

  # Overwriting the sign_out redirect path method
   def after_sign_out_path_for(resource_or_scope)
    root_path
   end

end

The return value of this method is the redirect url after sign-out, so you can replace root_path in the method above to set where devise redirects the users after signing out. The method after_sign_out_path_for is overloading the one contained in lib/devise/controllers/helpers.rb within the gem.

Similarly, you can change the default redirect path after sign-in by overriding the after_sign_in_path_for method of devise, like this:

def after_sign_in_path_for(resource)
  root_path
end

You can change the root_path here with the url of the page you want the users to redirect after successful sign in.