Should "Page is loaded when current user is logged out" supersedes other events?

Could y’all check my understanding. Let’s say that I have a page with 2 different on page load events with the following conditions:

  1. Current user is logged IN → go to page login
  2. do a search for blah: count ≥ 1 → show popup

My understanding is that event 1 happens on the server so it will immediately execute and event 2 will not even be evaluated.
I think @petter shared some tip like that recently that said you could check the redirect number or something of that sort.

1 Like

Number 1 should trigger on the server and send you to the login page before any page data is loaded.

Number 2 I guess could do the same (since it’s a server-side query), but I don’t know if it actually does.

Would be good to know – do you have this set up? If so you can use the 301 redirect checker to check whether it leads to a 301 redirect (a client-side will return a 200 redirect).

Just remember to remove the logged in event before testing :slight_smile:

Thanks, NorseSecurityNerd :nerd:. That page you suggested doesn’t really work for me. Can you try these 2 urls?

With a different tool I get:

I get a 200.

Even when I try with a blank page with just 1 condition, I get a 302. Should it be a 301 instead?

I forgot to mention: both pages have a redirect if not logged in action but they behave differently. Should it be so?

Sureoak’s tool seemed to be down for a while, but it’s back up now.

I get the same results as you:

  • 200
  • 302

301 and 302 are permanent and temporary redirects (as I’m guessing you already know). Both confirm a server-side redirect, and in many cases 302 makes more sense than 301. 301 is basically for URLs that don’t exist anymore. If you’re redirected for being logged out, it doesn’t mean that the page doesn’t exist.

Anyway, which 3xx code is returned doesn’t really matter to users, since the result is the same. It’s mostly for the search engines.

Logged-in actions should return 3xx, not sure why that’s not the case here. Care to share some more details?

@rico.trevisan did you find out where it came from?

Is your redirect made on a logged in or logged out condition?
If your check is for logged-in status, I think it’s best to check on your devtool network tab instead of the online redirect checkers

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.