[ad_1]
Hi there,
I downloaded redirection plugin to redirect non-logged in users to login page, I want some pages to be reserved for logged in users.
Firstly I used the user’s login status to determine the match. I wrote target URL (the login page) when the source URL is matched and the user is not logged in and left the Logged In target URL field blank, as it appears in the documentation.
I ran into the problem that I was always directed to the login page. It didn’t matter if he was online or not.
Secondly, it occurred to me to use the URL and Role/Capability option, since the connected user can edit the posts, I thought first I tried to use the roles but I found the new problem that it added the role of administrator and subscriber not it worked for both roles.
I finally used the edit_post capatibiliy and it worked! But only for a moment. Because if you click a page as an offline user and it redirects you to the login page. Then when you click again as a connected user, you are redirected to the login page.
With an example it is much better understood: imagine I have two URLs, page A and page B. If I have the capatibility to edit the posts and I click on A or B nothing happens, however if I do not have that capatibility it redirects you to the login page. The problem that arises, if I am not connected and I click for example on A, it redirects me to the login page, I connect and when I click on page A, it redirects me back to the login page. However if I click on B, nothing happens, it works! And the same thing but the other way around if it was page B I clicked on it at the beginning, A works for me but B doesn’t!
I guess this is all a cache issue because when you log out and clear cache, the issue changes depending on which page you use to log in.
I don’t have liteSpeed or any similar plugin installed, as I know that kind of plugin causes caching issues.
Please can someone give me a solution? I only want to redirect users who are not logged in to the login page when they try to access certain pages.
Thanks in advance,
Adrián.
The page I need help with: [log in to see the link]
