Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4019724
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:08:25+00:00 2026-05-20T10:08:25+00:00

I have created login functionality on my site, and when I click logout the

  • 0

I have created login functionality on my site, and when I click logout the page redirects and destroys session, which is fine.

However when I click the back button I can still view the page. If I refresh it, then it will redirect me to login as the session has been destroyed and the user does not have access to the page like expected.

Is there a way I can prevent the user from being able to view the page when they click the back button?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:08:25+00:00Added an answer on May 20, 2026 at 10:08 am

    Try to perform a

    header( 'Location: http://mySerbver.com/anURL' );
    

    after you did destroy the session. This makes returning to the previous page at least a bit more complicated. To go back, user has to click back twice.

    If you’d like to make it even more complicated, perform

    header( ‘Location: http://mySerbver.com/myScript.php?onceMore=yes‘ );

    and if the myScript.php finds

     isset( $_GET[ 'onceMore' ] )
    

    then perform

     header( 'Location: http://mySerbver.com/myScript.php' );
    

    once again.

    myScript.php:

    <?php
    
      // Force the browser to redirect once again
      if ( isset( $_GET[ 'onceMore' ] ) {
        header( 'Location: http://mySerbver.com/myScript.php' );
      }
    
      // else continue with normal stuff.
     ...         
    

    Additionally, it might be of help to instruct the browser to not cache pages:

    header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");   // date in past
    

    Please note, that browser may or may not respect this header. Thus, you probably need to send further cache related headers.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just starting out in asp.net. Have just created a login.aspx page in my site
I have created a user login page and am using Forms Authentication. Users are
I have created a login page using java swing. and i created jar for
I have a moderately simple assignment, to create a PHP/PDO site with login functionality
I have created login account on my localhost\sql2008 Server (Eg. User123) Mapped to Database
Hi I want to create a WCF service that have login method, which is
I'm creating a login page. I want to create ASP.NET TextBox controls that have
I have this authnav='<li class=last><a href=auth/login>login</a></li>'+ '<li><a href=auth/create_account>create account</a></li>'; It works fine in Firefox,
I have two sites which I use the same cookie for login which works
I have created one Login Screen where user enter their mail id. But i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.