How to get rid of PHPSession ID at the end of URL

Discussion in 'Programming' started by jennypretty, Dec 12, 2007.

  1. #1
    Hello,
    When I moved a new host, bluehost, I sometimes saw PHPSession ID at the end of the URL from my dating sites. When I refresh that page, and it is gone.

    does it affect my sites?

    How to get rid of PHPSession ID at the end of URL?

    Thanks.
     
    jennypretty, Dec 12, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    The session ID appears the first time at the end of the URL, when the session cookie isn't set. Then when you reload the page or go to another one, it'll disappear. PHP rewrites these tags automatically because the session would be lost if the server can't keep track of the ID.

    Meaning, if your site doesn't use sessions, your server probably has session auto start configured. But if you DO use sessions on your site, I suggest don't trying to remove this ID, because it's necessary for users who don't have cookies enabled.
     
    nico_swd, Dec 12, 2007 IP
  3. jennypretty

    jennypretty Active Member

    Messages:
    584
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thank you.
    I'll not change anything.
     
    jennypretty, Dec 13, 2007 IP
  4. Estevan

    Estevan Peon

    Messages:
    120
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    0
    #4
    hello
    this remove !

    For a .htaccess file you should add the following line:

    php_flag session.use_trans_sid off

    And in PHP code:

    ini_set('session.use_trans_sid', false);
     
    Estevan, Dec 14, 2007 IP
  5. jennypretty

    jennypretty Active Member

    Messages:
    584
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #5
    Let me try this.
    Can I put this ini_set('session.use_trans_sid', false); on the top of the php page? If I have 50 pages, then I have to place on 50? how about templates?
    Thanks.
     
    jennypretty, Dec 14, 2007 IP
  6. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #6
    If you really want to remove it, use the htaccess version he posted. You just have to create one new file and upload it.
     
    nico_swd, Dec 14, 2007 IP
  7. jennypretty

    jennypretty Active Member

    Messages:
    584
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #7
    Let me try this and get back.
    Thanks.
     
    jennypretty, Dec 19, 2007 IP
  8. jennypretty

    jennypretty Active Member

    Messages:
    584
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    58
    #8
    I added this line php_flag session.use_trans_sid off
    to the top of my htaccess file, but it does not work.
    Please help.
    Thanks.
     
    jennypretty, Jan 5, 2008 IP