Wix location to URL with current user id

i am trying to create a button the links to a page on the website with the current users id. I created a page on my website with the url www.wixsite.com/{user ID). So when a user is logged in to their page they have a button that redirects to the page i created with their user ID.

export function button1_onclick() {
wixLocation.to(/${wixUsers.currentUser.id});
}

this code hasn’t been working for me.

The URLs that you are constructing are not valid Wix site URLs. In order to accomplish what you want, see the Wix Code Tutorial: Building Your Own Members Area .

Hello Yisrael,

I followed the instructions on the post you referred to but it didn’t seem to work for me. Could you maybe check out my problem and tell me how I could fix that? I would really appreciate it! :slight_smile:

The detailed post about my problem is here: https://www.wix.com/corvid/forum/community-discussion/dynamic-profile-page-with-id-url-doesn-t-work-error-404