--- title: "Redirecting Customers to their Home Location" slug: "redirecting-customers-to-their-home-location" updated: 2023-07-26T15:44:41Z published: 2023-07-26T15:44:41Z canonical: "help.nexudus.com/redirecting-customers-to-their-home-location" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.nexudus.com/llms.txt > Use this file to discover all available pages before exploring further. # Redirecting customers to their home location when they try to log in via the network This customization snippet lets you automatically redirect {{variable.customers}} to their home {{variable.location}} whenever they try to log in to your {{variable.MembersPortal}} via your network {{variable.location}}. :::(Info) (This customization only works if you're using [version 4](/v3/docs/finding-your-members-portal-version){target="_blank"} of the {{variable.MembersPortal}}. ) ::: * * * 1. {{snippet.FirstStepProcedure}} 2. {{snippet.Settings_WebTemplate_Path}} 3. {{snippet.ClickPagesComponents_Step}} 4. {{snippet.AddFile_Step}} 5. Name your file **redirection.jsx** and press **Enter** on your keyboard. 6. Add the following snippet to your file. ``` import React, { Component } from 'react'; import { inject, observer } from 'mobx-react'; import { withTranslation } from 'react-i18next'; import DefaultLayout from 'ui/layouts/DefaultLayout'; import Breadcrumbs from 'ui/components/Breadcrumbs'; import LoadingLayout from 'ui/layouts/LoadingLayout'; @withTranslation() @inject('appStore', 'authStore') @observer class CustomPage extends Component { componentDidMount() { const { authStore, appStore } = this.props; if(authStore.isLoggedIn){ setTimeout(async () => { const me = await authStore.loadMe(); const homeSpace = appStore.businesses.find(b => b.Id == authStore.customer.HomeSpaceId); if(homeSpace){ window.location = homeSpace.HomeUrl + `/login?t=${me.AccessToken}`; } }, 2000) } else { window.location = `/login?redirectUrl=${encodeURIComponent('/pages/sso')}` } } render() { return ( ); } } export default CustomPage; ``` 7. {{snippet.Save}} * * * All set! We recommend testing the customization by trying to log in from the network using a test {{variable.customer}} account.