Search code examples
joomlajoomla3.0

Redirect on Permission Error Joomla 3


Issue

Accessing a page without permission gives the error message:

You do not have permission to view this resource. Please contact the Site Administrator.

However, it should instead redirect to /login


Solution

  • Joomla Solution

    Set the permission of the given menu item to Registered, and anyone who is not will be redirected to your login page.

    Code Solution:

    If you want to break the rules and implement this with code, you can add the following code into your template:

    if ($('.cAlert:contains("You do not have permission to view this resource.")').length) {
        window.location.href = "/login";
    };