Remove SessionID from URL string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Remove SessionID from URL string

Post by blacksnday »

I have noticed a problem that looks horrible.
On my site for some reason, when you first enter and click any link,
the SessionID wants to be attatched. then after the first click, it goes away.

This is causing many problems with Search Engines.
As for security, thats not a problem yet as I dont offer any type of
membership system.

Is there a way to remove the Session ID from showing upon entry to site?

You can see the problem by doing a MSN search of my site.
All of MSN attatches a SessionID to the indexing....
http://search.msn.com/results.aspx?FORM ... shmyex.com
and i think its causing Google to not crawl anymore.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

On your host, is your session.auto_start set to On ?
Check using phpinfo()
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

set
session.use_cookies=1
and
session.use_only_cookies=1

this way you will still be able to use sessions, but no SID will appear in your urls
User avatar
Nathaniel
Forum Contributor
Posts: 396
Joined: Wed Aug 31, 2005 5:58 pm
Location: Arkansas, USA

Post by Nathaniel »

Use ini_set() to set Weirdan's config values.
pilau
Forum Regular
Posts: 594
Joined: Sat Jul 09, 2005 10:22 am
Location: Israel

Post by pilau »

Is SessionID presents using GET on URLs as a default?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

pilau wrote:Is SessionID presents using GET on URLs as a default?
typically, yes.
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Post by blacksnday »

Weirdan wrote:set
session.use_cookies=1
and
session.use_only_cookies=1

this way you will still be able to use sessions, but no SID will appear in your urls
I checked and both are on as a local value.

With session.auto_start set to ON
would that mean that I wouldnt need to use

Code: Select all

session_start();
in scripts?

I would think I still would and should use it, just wanted to
clarify a bit.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

with auto_start on, session_start() is called just prior to starting the script on all affected files. This behaviour may not be wanted in many cases, so it's suggested to not have it on.
User avatar
blacksnday
Forum Contributor
Posts: 252
Joined: Sat Jul 30, 2005 6:11 am
Location: bfe Ohio :(

Post by blacksnday »

I found that if I use full url paths for any link within the site, then
the Session ID problem goes away.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Post by Weirdan »

blacksnday wrote:I found that if I use full url paths for any link within the site, then
the Session ID problem goes away.
It's beacause url rewriter considers full urls to be external links.
Post Reply