Overcoming Duplicate Content by using Server-Side Optimization


Recently while working on www.rozoil.com , a Connecticut heating oil company website we encountered some interesting errors in the original developers coding.

Turns out they were using a database driven price calculator that would update the daily oil price through an administrative panel.

What was happening is that Google and the various other bots were caching a PHP session ID that was being set in addition to the cookie. Obviously our friend Google isn’t 100% good yet with handling session id’s.

Why do we disable the PHPSESSID?

Someone comes to the page with their cookies disabled in their browser, PHP would automatically add a PHPSESSID into the URL (uniform resource locator) of every page this is their way of managing and maintaining the state between pages.

Search Engines spider a website without cookies so they will see this PHP session id and overcount URL’s in many cases.

FOR THE USER:

A user wont remember www.mywebsite.com/sitepage.php?PHPSESSID=4852409589245804809 but they will remember www.mywebsite.com/sitepage.php


FOR THE ENGINE:

Unless you want your pages to end up in the supplemental index when you show your session ID blatent in your URL querystring it makes computer hackers job of compromising your session easier. In cases where the code isn’t strong you can even have a session be shared between more then one browser.

In the days where many browsers disabled cookies they were very needed but with people surfing compliant pages from their iphones and everything pushing towards the post web2.0 bubble I think its fair to say we can use cookies, and I don’t mean chocolate chip though that is my favorite I mean the browser kind.


What we Did:

The below information only works if you are using an Apache Webserver.

Place the following lines in your .htaccess file.

php_value session.use_only_cookies 1 

php_value session.use_trans_sid 0

I hope you found the below information to be helpful and if this doesnt make sense (like i figure it won’t cause i’m a terrible writer then just shoot me an email and i would be glad to help


Bookmark and Share