cancel
Showing results for 
Search instead for 
Did you mean: 

Restrict page depending on previous url

Restrict page depending on previous url

Hi all, I'm working with magento 2.4, I'm new working with magento so I don't know too much.

I have a registration process that goes from page A -> B -> C, I need: if you are on page C and click the browser's back button I need it redirects me to page A and not to page B. Is like when the page B is loaded check if the previous page is A or C, if is A the page B can show, if the previous page is page C, I need a redirect to page A.

I tried to do this with  an Observer, It works perfectly  if I put the B url manually, it redirects  me to page A but when I am in page C and click the browser's back button the Observer doesn't  redirect to page A as I needed