You are here: Re: session_start not work with rewritengine « PHP Language « IT news, forums, messages
Re: session_start not work with rewritengine

Posted by Rik on 01/03/07 15:54

Tyrone Slothrop wrote:
> On Wed, 3 Jan 2007 12:22:20 +0100, artev <mailnotspammm@notspamm.nn>
> wrote:
>
>> I have some files php that use the session_start for archive
>> datas in a variable $_SESSION['archive'] = $list;
>>
>> they not work more if in the file .htaccess I use this code
>> (for to have permalink)
>>
>> <IfModule mod_rewrite.c>
>> RewriteEngine On
>> RewriteBase /site/
>> RewriteCond %{REQUEST_FILENAME} !-f
>> RewriteCond %{REQUEST_FILENAME} !-d
>> RewriteRule . /site/index.php [L]
>> </IfModule>
>>
>
> I had the same problem just yesterday. According to PHP manual on
> php.net, sessions are not carried when there is a redirect. Since a
> mod_rewrite is on the server level, I doubt there is a simple hack
> around this. I ended up using my tried and true session functions,
> passing the session id in a query string and saving the session values
> in a MySQL table.
>
> I would be interested to know if there is a way to code around this
> limitation.

I user mod_rewrite in combination with sessions all the time. No problem if
they are in a cookie (and offcourse the domain stays the same...), or if
it's in the POST in an internal redirect. When the session id is in a GET
variable, add the [QSA] (query string append) flag to all your rewrites so
it will be carried over, like:
RewriteRule . /site/index.php [L,QSA]
--
Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация