You are setting the cookie by using the following function:
setcookie("rel", "", time() - (86400 * 90) , "/", "", 1);
The fourth parameter ("/"
) describes the path the cookie is set on.
The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain. If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain. The default value is the current directory that the cookie is being set in.
Cookies must be deleted with the same parameters as they were set with. If the value argument is an empty string, or FALSE, and all other arguments match a previous call to setcookie, then the cookie with the specified name will be deleted from the remote client. This is internally achieved by setting value to 'deleted' and expiration time to one year in past.
php.net
If you want to delete the cookie, you have to delete it with the right path, in your case "/"
, you might want to use the following function call to let the cookie expire:
setcookie("rel", "", time() - 3600, "/");