5

When the user is logged in and trying to access the homepage I need to redirect him to certain url. So basically when authorized user gets to www.example.com he's redirected to www.example.com/dashboard.

What's the way to do this?Joomla version is 3.3.6

  • 1
    Maybe consider rephrasing your question. Should homepage really be hidden from logged in user or you only want to send him to alternative landing page (keeping original home page still available)? – miroxlav Jan 21 '15 at 9:33
6

I've used Nomad in the past - instead of redirecting, it's a system plugin that actually overrides the default home page and replaces it with your choice of locations based on User Groups.

  • +1 for this. Was a bit skeptical when looking at the latest review for this, but definitely going to try this out myself – Lodder Jan 21 '15 at 14:17
  • Just saw those for the newer Joomla...the sites we use it on haven't been upgraded yet due to a PHP version issue, but it's handy enough that I'd spend the time fixing it....a VERY nice to have. – GDP Jan 21 '15 at 15:31
4

You can always use extension like this to redirect users on login:

http://extensions.joomla.org/extensions/extension/access-a-security/site-access/redirect-on-login

  • and what if they manually type in the URL? – Lodder Jan 21 '15 at 9:56
3

In addition to redirecting then when they try to access the homepage, you can also redirect them once they have logged in. To do this, open the Login module in the Module Manager and you will see an option on the left called Login Redirection Page.

For your main question though, this can't be achieved using htaccess, so instead you'll need to use PHP. At first I thought a menu item would do the trick but this will only work if they click on the menu item and not if they manually type in the URL.

So what I would do is, open you index.php for your template and add in the following:

$app  = JFactory::getApplication();
$menu = $app->getMenu();
$user = JFactory::getUser();

if( !$user->guest )
{
    if ($menu->getActive() == $menu->getDefault()) 
    {
        $app->redirect(JRoute::_(JUri::root().'/dashboard');
    }
}

Note: I quickly mocked this code up but haven't yet tested it, so let me know if it works or not.

Hope this helps

  • thanks for your input. The script, unfortunately, did not work so I've decided to go with the Nomad extension – Ubertone Jan 30 '15 at 10:54
2

There is actually a very simple way to do it in Joomla 3x.

  1. Go to Users > Access Levels and click on the Guest access level. By default, under User Groups Having Viewing Access, only Guest is checked. Check the Public box as well and then click Save.

  2. Go to your menu and click on the Home link to edit it. In the Access drop down on the right hand side, set it to Guest instead of Public and then click Save.

Voila! From now on your Home link will be hidden from users who are signed in.

Hope this helps!

  • Why did you edit my response? – Cynthia Jan 23 '15 at 0:21
1

For a different approach, you can try a content restriction plugin like OSD Content Restriction. You won't have different homepages as you asked for, but you can show different content to guests and members in your articles (and Custom HTML modules) using the following tags:

{guest}
  This content is only visible to guest users, 
  and NOT visible to registered/logged in users.
{/guest}
{!guest}
  This content is NOT visible to guest users.
  Only logged-in users will be able to see it.
{/guest}
  Any content outside the tags will be visible to both guests and registered users.

What is shown or hidden can be determined by six different variables, namely the user group, the user, the author group, the author, if on the homepage or if an article is featured.

0

You could do the quick and dirty method, ie a custom HTML that has registered for access and is visible only on the home page, then redirect with javascript. It works well enough if the position is in the beginning of the page. I'd presume those plugins for adding custom javascript can do this as well.

0

Create two user groups "Guest" and "Register". Add home menu under "Guest group". Add other menus in "Register group". Add the user in "Register" group . So when a user logs in the guest menu is hidden. Hope this helps.

0

I've recently wanted to achieve exactly the same thing: provide different homepage for logged in users

The earlier plugin didn't get good reviews so I tried Custom Member Homepage plugin. Works really well.

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.