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

I have a classifieds website, and I am about to create a members login
I am trying to use a textarea form entry which I have some javascript
I'm currently trying to add an admin mode to my cakephp site. I followed
I'm working For my company on a .NET N-tier architecture and have several questions.
I have an app that successfully uses Facebook's single sign on to log a
I am working with navigation based application. Every cell creates a detailView. i have
I've been experimenting with the BizTalk Adapter Pack, specifically with the SAP stuff. I'm
I'm essentially planning to mimic the comment functions on PDF files, but online. That
I'll try to give as much info as I can without giving more than
I am currently working on a forum and using a lot of raw AJAX

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.