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 7368151
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:37:44+00:00 2026-05-29T03:37:44+00:00

I have the following log-out script: setcookie(key, , time() – 36000); setcookie(usr_email, , time()

  • 0

I have the following log-out script:

setcookie("key", "", time() - 36000);
setcookie("usr_email", "", time() - 36000);
session_destroy();
header("Location: http://www.site.net/");

When I like to that page directly (logout.php) it works great and logs the user out.

But for some reason, when I use:

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^log-out /logout.php

I can see that the redirection works, but the log-out is not being carried out.

EDIT: just checked, after being redirected back to the homepage, the cookies are still available. Just a clarification, if I go directly to the logout php file it works great.

  • 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-29T03:37:45+00:00Added an answer on May 29, 2026 at 3:37 am

    I think the problem is that hyphen in your htaccess file. Try this:

    RewriteRule ^log\-out /logout.php
    

    Could you also tell the errors/behaviour that happens?

    Edit:
    The problem is in your PHP then. First of all, I’d recommend storing login-related data in sessions, not cookies. Cookies can be added and edited by users.

    Anyway, the code should successfully clear, if not delete, the cookies. So it may be that you’re checking if you’re logged in based on if the cookies exist, rather than their content. In this case try if(empty($_COOKIE['key'])), which will check if it’s empty or not.

    To remove a cookie completely: unset($_COOKIE['key']).

    By the way, session_destroy() is not related to cookies at all.

    Edit 2:
    Try assigning the cookie to your domain and all its subdomains (including www):

    setcookie('key', '', time() - 36000, '/', '.mysite.net');
    

    Do the same when adding the cookies.

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

Sidebar

Related Questions

I'm attempting to write a bash script to parse out the following log file
I have the following shell script that echos output to the log and errors
I have the following log entry that I am processing in PowerShell I'm trying
I have the following code snippet: #ifdef DO_LOG #define log(p) record(p) #else #define log(p)
I have the following SQL-statement: SELECT DISTINCT name FROM log WHERE NOT name =
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party
Let's say I have the following simple script: print ID : ; $ID =
I have a problem with the following piece of PHP script: <?php abstract class
I have the following code, trying to test out WebWorkers. I have an index.html
I have the following html and js code snippets. Basically, I'm trying out Ember's

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.