Forum Moderators: phranque

Message Too Old, No Replies

Problem with htaccess and setcookie en php

         

Max134

2:16 pm on Mar 21, 2011 (gmt 0)

10+ Year Member



Hello

this is my htaccess file:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^mysite.com [NC]
RewriteRule ^(.*)$ http://www.mysite.com/$1 [L,R=301]


RewriteRule ^member/([0-9]*)/([0-9]*)/$ member.php?user=$1&logout=$2 [L]
RewriteRule ^member/([0-9]*)/$ member.php?user=$1 [L]
RewriteRule ^member/ member.php [L]


and to delete the cookies, my php code is next:
setcookie("cookiename", '1', time()-3600);
setcookie("cookiename", "1", time() - 3600, "/", "http://www.mysite.com");


this code works fine with the not friendly url, if I type
http://www.mysite.com?user=1?logout=14 
the cookie is deleted, but If I type the friendly url like

http://www.mysite.com/1/14/
the cookie is not delete.

I try several options and I google it, but I can't found the solution at this moment.

Thanks in advance !

g1smd

2:23 pm on Mar 21, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



One problem with your code.

Replace ([0-9]*) with ([0-9]+) otherwise you allow the URL example.com/member/// to be valid.

I don't know the answer to the cookie problem.

Max134

11:06 am on Mar 23, 2011 (gmt 0)

10+ Year Member



No ones know the solution ?

jdMorgan

11:36 pm on Mar 28, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The problem is either in the "delete cookie" php code, or perhaps that code is not included in your "member.php" script.

Jim