Welcome to WebmasterWorld Guest from

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

htaccess - SetEnvIf/Browsermatch & php_value

Can I conditionally set php_values depending on Browser

6:07 pm on Jun 27, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 26, 2002
votes: 0

I can set an environment Variable
Browsermatch "GoogleBot" isBot

Or I can use SetEnvIf combined with Host-Ip matching to set it.

Independently I can also use php_value
php_value session.use_trans_sid 0

to turn of transitional sessions (i.e. appending session_ids to the URL if cookies are disabled).

My Question is: Can it be combined? Can I set the value for session_use_trans_sid depending on an environment variable or User_Agent_string/IP?

10:07 pm on June 29, 2003 (gmt 0)


WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
votes: 0

I guess it is possible with ini_set but I am not sure how well it will work. You would have to call ini_set on each page and I am not sure if it may mess with the session.

Interesting idea but I am not sure what will happen, have you tried it at all?

3:03 pm on July 2, 2003 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 26, 2002
votes: 0

ini_set cannot work. The session-part is initialized before the script is even being parsed.


session.use_trans_sid "1" PHP_INI_SYSTEM¦PHP_INI_PERDIR
PHP_INI_PERDIR 2 Entry can be set in php.ini, .htaccess or httpd.conf
PHP_INI_SYSTEM 4 Entry can be set in php.ini or httpd.conf

The value for session_use_trans_sid cannot be set in a script. It has to be done in .htaccess

I have tried to use an environment-variable with php_value, but that does not work. I thought there might be a workaround with rewriting and/or <files> etc.. But I am not firm enough with apache to do it myself. But maybe it is not even possible at all...


Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members