Forum Moderators: phranque
In my specific case, i have a permalink activation control. When it's OFF, and the website sections are called through index.php?id_section=5, the cookies inside index.php are saved correctly.
When i turn the permalinks option ON (http://www.mysite.com/contact_us/support/ .. which is id_section=5), the cookies are some-how saved, but the php script ignores their value.
Some has a solution for this?
.htaccess: *****************
RewriteEngine on
#Languages
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(_([A-Za-z]{2}))/?$ /index.php?l=$2 [L]
RewriteRule ^(.*)/_([A-Za-z]{2})/?$ /index.php?l=$2 [L]
# Sections
RewriteCond %{REQUEST_FILENAME}!-f
RewriteCond %{REQUEST_FILENAME}!-d
RewriteRule ^(.*)$ /index.php [L]
index.php ********************
if ($_GET['l']) {
# querystring (some checking here...)
$lang = strtolower($_GET['l']); }
} elseif($_COOKIE['l']) {
# cookies (some more checking here...)
$lang = $_COOKIE['l']; }
}
if (!$lang) { $lang = $config['lang']['default']; }
# lang cookie
setcookie('l', $lang, time()+$config['lang']['exp']);
Therefore, a newly-set cookie is not available to the server until the client makes a new request.
Jim