# Redirect logout to another page

**URL:** <https://forum.wixstudio.com/t/redirect-logout-to-another-page/7082>\
**Category:** Ask the community\
**Tags:** question, code, wix-members-area\
**Created:** [July 25, 2023, 2:45pm UTC](https://forum.wixstudio.com/t/redirect-logout-to-another-page/7082 "2023-07-25T14:45:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![naragrheamae](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/naragrheamae/32/80256_2.png) [@naragrheamae](https://forum.wixstudio.com/u/naragrheamae)\
**Post date:** [July 25, 2023, 2:45pm UTC](https://forum.wixstudio.com/t/redirect-logout-to-another-page/7082/1 "2023-07-25T14:45:12Z")

</div>

Is it possible to redirect a member to home page (or any other page) when they logout from the members-only page?

Here’s what happened…

We have this members-only page. I clicked it.  
I decided to logout.  
Error 404 is showing.

We as Wix experts understand that it’s showing the error 404 because the link is supposed to be accessed by members-only. But other people don’t know that! They assumed something went wrong and they can’t logout.

So is there any way we can just show/pop up the “sign up/login” form again OR redirect them to homepage? Just to show that they have “successfully logged out”.

PS. I checked with Wix support already and they don’t have other solution aside from customizing the error 404 page.

I posted here to see if this can be resolved using Velo / code.

Thank you so much!

---

<div class="post-metadata">

**Author:** ![reswebdev](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/reswebdev/32/31109_2.png) [@reswebdev](https://forum.wixstudio.com/u/reswebdev)\
**Post date:** [August 2, 2023, 4:44pm UTC](https://forum.wixstudio.com/t/redirect-logout-to-another-page/7082/2 "2023-08-02T16:44:44Z")

</div>

You should be able to add an on logout function in the header of the site that redirects to a page using wixlocation.

Here are links on how to do so -  
[onLogout()](https://www.wix.com/velo/reference/wix-members-frontend/authentication/onlogout?utm_source=google&utm_medium=cpc&utm_campaign=12188669214%5E122749788651&experiment_id=%5Eb%5E494823160042%5E%5E_DSA&gclid=Cj0KCQiAkZKNBhDiARIsAPsk0WgOHyHL3IwsMnkqqVqRDALg5Ta1FrpFK2mS8g5U64tjazTUY0rt1QoaAtDjEALw_wcB)  
[wixLocation.to()](https://www.wix.com/velo/reference/wix-location-frontend/to?utm_source=google&utm_medium=cpc&utm_campaign=12188669214%5E122749788651&experiment_id=%5Eb%5E494823160042%5E%5E_DSA&gclid=Cj0KCQiAkZKNBhDiARIsAPsk0WgOHyHL3IwsMnkqqVqRDALg5Ta1FrpFK2mS8g5U64tjazTUY0rt1QoaAtDjEALw_wcB)

---

<div class="post-metadata">

**Author:** ![Aaron\_Whittington](https://avatars.discourse-cdn.com/v4/letter/a/ad7895/32.png) [@Aaron\_Whittington](https://forum.wixstudio.com/u/Aaron_Whittington)\
**Post date:** [August 2, 2023, 5:53pm UTC](https://forum.wixstudio.com/t/redirect-logout-to-another-page/7082/3 "2023-08-02T17:53:47Z")

</div>

I achieved this simply by resolving both at the same time.

Here’s the code:

```javascript
$w("#menuAccountLogout").onClick(() => {
    Promise.all([wixUsers.logout(), wixLocation.to("/")])
});

```

This is a bit legacy so I’d use the new Wix Members logout method instead of Wix Users, but the idea is here.
