Hola Joomlers! Have you ever wanted to redirect users to a different page after a successful login? I certainly have. By redirecting users after the login, you can provide them a clear path to action. And every customization we make to our Joomla site to better the user experience is important!
This one little trick lets your users hit a page of your choosing instead of the default home page. It also comes in handy to streamline the user experience or redirect users to premium or member-only content.
Today, we’ll show you how to do just that – in two different methods! So without further ado, let’s get started.
Redirect Users to a Different Page After Login
A redirection page is like a roadmap telling the users what to do next. In case you’re wondering where to redirect users after a successful login, here are some examples of good redirection pages:
- Custom dashboard for admin users
- Custom dashboard for frontend users
- Order details page for pending orders
- Product/service page
- Sales and coupons tailored for that specific user
- Feedback and customer support forms
Alright, now that you know where you can redirect the users for a better experience, it’s time to implement it.
There are two ways you can set a custom login redirect. One by creating a login link to your navigation, and another by creating a login module. We will demonstrate both methods for you in detail so that you can figure out what works best for you.
Method 1: Create The Login Link
This method is pretty simple and straightforward. All you have to do is create a menu item of the type Login that will appear in your navigation.
Go to your Joomla site’s back-end admin dashboard, then Menus > Main Menu > Add New Menu Item.
Title: Set the menu item title to Login
Menu Item Type: Choose Users > Login Form
Access: Set the access level for this link to Guest
Hit Save & Close. Now the Login menu item will appear in your navigation if you are not logged in already. Once you’ve logged in, this will disappear as we have set the access level to Guest.
Method 2: Use the Login Module
This method involves using a login module to redirect users after they log in. Here’s a step-by-step on how to do that.
Step 1: Create a Login Module
Go to the backend admin dashboard of your Joomla site. Now head over to Extension > Module > New and search for Login.
Let’s configure the Login module as below.
Title: Give the Login module a title, for this example, we’ll set it to login.
Position: Select the position where you would like the Login module to show up on your site. We’ll set the position to the top right of the home page.
While setting the position keep in mind if the login box is located at the bottom of a home page users might find it difficult to find it. Try to move the login box to the top of the page as much as possible.
Login Redirection Page: This is where you set the page you want users to visit after they log in. Let’s set it to Services because I want the users to check out the amazing services we provide first thing right after they log in.
From the Select button, you can choose any page that’s connected to the menu item on your website to send your users after login.
If you keep the “Default” option, the user will get redirected to the website’s default page, which is usually the home page.
Similarly, you can set the Logout Redirection page as well.
Step 2: Module Assignment
We are almost done. What’s left is to select the pages where we would like the login module to display.
Tap on the Menu Assignment tab and select your preferred page/pages. I want it to show on my home page only, hence selecting the default home and home page for other languages (for a multi-lingual site). If you are interested to know how to make your Joomla site multi-lingual, visit Here.
Now after you log in, instead of the default home page you will be redirected to the service page of your Joomla site. But wait a minute. We didn’t display the login module on the service page, so how do we log out? Read the next section to find out how.
Customize the Joomla Login for Better UX
After you log in, the login module converts to a logout button. And from there you can simply log out. But we have only selected the home page for the module to be displayed on.
This means a user will need to go back to the home page to log out of the site. Sounds very inconvenient, doesn’t it? How about if we could have a logout button on every page of the site without displaying a login box on each page? There are two ways you can do that.
Method 1: Use The Login Module For Logging Out
In the first method, we will create a second login module to act as a logout button. Go to Extensions > Module > New and then select Login.
You can set the title to Logout. Assign the access level to Registered. Now go to the Menu Assignment tab and select all pages except the ones you have selected for the first login module.
This module will only appear if you are logged into the site since we have set the access level to Registered. And when you are already logged in, the module displays as a logout button.
Now if you click the logout button, this module will no longer display because you’ve logged out and not a part of the Registered access level anymore! There you have it – a logout button on every page of the site without displaying a login box on each page.
Method 2: Create the Logout Link
You can also create a logout link in your navigation that will only appear when you are logged into the site.
To do that, from the admin dashboard go to Menus > Main Menu > Add New Menu Item.
Title: Set the menu item title to Logout
Menu Item Type: Choose Users > Logout
Access: Set the access level for this link to Registered
Hit Save & Close. Now the Logout menu item will appear in your navigation if you are logged in. This method is more preferable to method one as it is more intuitive and works better with any site design.
Wrapping Up
As you can see, Joomla is very versatile and provides you multiple ways to work with the login of your site. With the above tweaks, you can easily customize the login experience on your Joomla site and enhance the user experience.
Still have a question about how to redirect users after logging in? Let us know in the comments below. Good day!