2

I would like my homepage to seen by every user. But anonymous users should be redirected to a login page if they click on any link. How can I achieve this?

2 Answers 2

0

There are many specific ways to do this, but here's the general idea:

Create a special content type for your home page that allows Anonymous access.

Then, set your other content types to require an authenticated user.

If you get stuck on a specific part of this process, or have more specific questions you may get better responses.

0

If I understand correctly, you want to have a front page with links to premium content. The front page should be visible to everyone, including the anonymous user role, while all other content should be premium (i.e. only be available to logged-in users, i.e. the authenticated user role). Users who are not authenticated should be redirected to a login page if they click on these links.

In Drupal, the default View access control is very crude. The permission View published content covers all content types. In order to have premium content on your site, you need to install a role based node access control module. Out of old habit, I use Content Access for role based access control. Some people think it is too marignally supported to be used on a production site, but it works for me. However, you may want to consider the alternatives.

With role based noded access in place, you can create a specific content type that everyone can see for use on the front page, and make all other content types premium.

You then need to set up the redirection to login. For this, I suggest you use the CustomError module. Clicking on a link to premium content will throw a so-called 403 error, and with CustomError, you can design your own 403 error page, which can be a login page.

Disclosure: I am co-maintainer for CustomError.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.