How to link to a dynamic member profile?

I believe it should be a really simple thing but I keep getting 404 error. Can anyone please help.

$w . onReady ( function (){
$w ( ‘#button1’ ). onClick ( function (){
let email = $w ( ‘#loginEmail’ ). value ;
let password = $w ( ‘#loginPassword’ ). value ;
wixUsers . login ( email , password )
. then (()=>{
wixLocation . to ( ‘/members/{Email}’ );
})
})
})

I see that you are redirecting to:

wixLocation.to('/members/{Email}');

Do you have a members page? Or is it Members?

Typically, you should redirect based on user ID. So, after the user has logged in, it would look something like this:

wixLocation.to(`/Members/${wixUsers.currentUser.id}`);

You are using the incorrect tick mark. You want to use the backtick ` and not the single quote '.

You want this
wixLocation . to ( /members/](wixLocation.to(/Members/${wixUsers.currentUser.id});) [${wixUsers.currentUser.id}](wixLocation.to(/Members/${wixUsers.currentUser.id});) [ );

not this:
wixLocation . to (’ /members/ ${wixUsers.currentUser.id}’ );

See Template Literals for more information.

I did change it to backticks but unfortunately still no luck

I am having the same issue, I am trying to let the onClick function of (my profile) button to take the member to the dynamic profile page. I have used the same code posted above and used the backtick but it seems that it is not responding. I have tried to change the location and the code would work fine for a static page (without the id part)

Is the site member logged in?

See the Velo Tutorial: Building Your Own Members Area .