# How do I redirect to a page only from a specific page and not directly in Django?

**URL:** <https://forum.djangoproject.com/t/how-do-i-redirect-to-a-page-only-from-a-specific-page-and-not-directly-in-django/14966>\
**Category:** Forms & APIs\
**Created:** [July 22, 2022, 3:17pm UTC](https://forum.djangoproject.com/t/how-do-i-redirect-to-a-page-only-from-a-specific-page-and-not-directly-in-django/14966 "2022-07-22T15:17:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![khaw235](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/khaw235/32/6372_2.png) [@khaw235](https://forum.djangoproject.com/u/khaw235)\
**Post date:** [July 22, 2022, 3:17pm UTC](https://forum.djangoproject.com/t/how-do-i-redirect-to-a-page-only-from-a-specific-page-and-not-directly-in-django/14966/1 "2022-07-22T15:17:24Z")

</div>

Hi there,

I have a lot of pages (urls) in my app. But there’s one page (url) let’s say `Page/URL A` which I want for user to land/visit only if he/she comes/redirects from another specific url let’s say `Page/URL B`. I don’t want user to view `Page/URL A` directly if the user put url in the browser.

To ease the help, I am posting the urls of both pages.

`Page/URL A` is:

```auto
path("invite-user/", InviteUser.as_view(), name="invite_user"), # Invite User Page

```

and `Page/URL B` is:

```auto
path(
        "switch-workspace/", SwitchWorkspace.as_view(), name="switch_workspace"
    ), # Switch Workspace Page

```

Can someone help me to accomplish it?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [July 22, 2022, 3:24pm UTC](https://forum.djangoproject.com/t/how-do-i-redirect-to-a-page-only-from-a-specific-page-and-not-directly-in-django/14966/2 "2022-07-22T15:24:06Z")

</div>

The only way I can think of that can come close (but still not enforce or guarantee) would be to generate a 1-time use token in PageA that is passed through the browser (cookie, url parameter, etc) to PageB, and is validated by PageB. Still doesn’t guarantee that you came directly from PageA, but is probably adequate for all practical purposes.
