Restricted Page Redirect Issue

Hi, I’ve encountered a specific issue and done a bunch of troubleshooting (which I’ll outline below). I’m stuck and need help!

I have pages that are restricted to paying members on my site. If a user navigates directly to a restricted page, they’re redirected to the Membership Option page to log in. At this time, during the direct, the MOP VARS are attached to the Membership Option URL. The user logs in using the pro form, and is brought to the membership welcome page. At this point, the MOP VARS are dropped from the URL. I then try and navigate back to the original URL that the user tried to access that was restricted (either through direct URL navigation or a button on the membership welcome page). At this time, I’m brought back to the Membership Option Page with the MOP VARS attached to the URL. I’m unable to navigate to that original restricted page, but can navigate freely among the other restricted pages.

For troubleshooting, I’ve:
-Deactivated/reactivated S2Member
-Added a wp-config define value (per this article: https://s2member.com/kb-article/how-to-avoid-login-issues/)
-Confirmed https vs HTTP, www vs none setup is universal throughout the site
-Confirmed URL setup in S2member for my membership option and welcome pages.
-Tried using the theme’s login widget instead of the pro form login
-Disabling all other plug-ins

Additional details:
-Divi Theme
-Everything is up-to-date
-I’ve noticed that exact URLs can make a difference in whether or not the page appears. For example, if I try navigating to https://samplesite.com/restrictedpage, I’ll get an issue after logging in. But, after logging in, if I navigate to the same URL with an ending forward slash, the URL will work and I can see the content as-expected.

My guesses are (but can’t see how else to troubleshoot):
-There’s an issue with the redirect from the originally restricted page to the membership options page to log in
-There’s still an https vs HTTP issue, as the site was originally built on HTTP before being converted over to SSL.

I’m trying to figure out what’s causing this “loop” of not being able to access the originally-restricted page.

Thank you for your consideration and help.

I’ve never experienced this problem but I understand the problem you are describing.

The cleanest solution is the universal solution I use on all my sites…htaccess configuration.

Decide whether https://www.xyz.com or https://xyz.com is your preferred site domain and add code to htaccess to 301 redirect all variants to that domain. With this in place all accesses to the WordPress / Theme / plugins will be uniform.

Tim, thank you for the help.

I’ve completed a lot of troubleshooting since then, including:

  1. Better Search Replace to ensure the site has all correct https & no www.
  2. Setup 301 redirect

The issue appears to be resolved - thank you for your assistance!

Brian

Excellent. Others who trip over this issue will benefit from this topic in the future. Thanks for following up :slight_smile:

This is a really old topic but this issue reappeared for me. I have tracked down the issue and wanted to amend the information in case anyone was looking for it.

To summarize, the issue would appear when a user would try and navigate directly to a membership-locked page before logging in. It would then cause a MOP VARS issue (identified in the URL) after logging in and trying to renavigate to the originally locked page. If I tried to navigate to this page again directly (even when logged in), I would instead be 302 redirected to the site’s login page with the MOP VARS appended to the URL string for the page.

I identified an issue where I was getting a 403 error (through Console -> Network -> Preserve Logs -> Doc / Documents). This led me to understand that my hosting environment (WP Engine) was caching these pages in such a way that logging in wasn’t correcting the permissions on the page.

Conclusion: Once I had my hosting provider exclude ALL membership URLS from caching, the issue was resolved.