SPA when user not logged in routes incorrectly

Hi!
I’m working on an SPA website.

I’m using index.php as the login page, and then the SPA home is CustomerHome.php.
So the “home” path is /CustomerHome/
And the Url is /CustomerHome.php

I can log in fine. And, the site is usable as long as I’m logged in.

But, when when I try to go to one of my pages, like /CustomerHome/ when I’m not logged in as a user, it incorrectly takes me to CustomerHome/index.php (i.e. like it’s following that route) instead of ./index.php (i.e. it doesn’t just take me to that page).

Any suggestions?

try please

<div is="dmx-route" path="/toplu_giris" url="spa/toplu_fatura_girisi.html" id="toplu_giris" dmx-on:forbidden="browser1.goto('./')"></div>

or

<div is="dmx-route" path="/toplu_giris" url="spa/toplu_fatura_girisi.html" id="toplu_giris" dmx-on:forbidden="browser1.goto('../')"></div>

1 Like

Sure, thank you!

I’ve tried making the security restrict Login URL or Forbidden go to:
./index.php
…/index.php
/index.php
/index.php

It’s also a little strange that CustomerHome/ works but CustomerHome without the trailing / doesn’t work.

try with browser component

What do you mean?

Nevermind, I got it to work.

I didn’t see you edited your answer above.

If I go into the code and hand-code …/ instead of just letting Wappler do it, it will work.

Thanks.

Do you know why Wappler won’t accept CustomerHome without a / at the end? It has to be CustomerHome/

This looks a bit suss to me. Have a look at what works for me:

Thanks for the help, Ben.

Pardon my idiocy :wink: but I’m not seeing a huge difference between yours and mind. Could you kindly point it out for me?

  1. I am not sure if you want a default page. If not, then ignore this
  2. You will need to supply the correct URL