remove PHPSESSID=.... from URL

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
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

remove PHPSESSID=.... from URL

Post by thosecars82 »

Hello there

I am just realizing that first time I enter into http://www.arreglaordenador.com and try to click on any of the header links like "Inicio", "Servicios", "Contacto", or "Acerca de mi" I see a really long dynamic url containing the url itself followed by ?PHPSESSID= .......................... where those ...... symbolize a string of chars

I have to say that this second dynamic part consisting of PHPSESSID=..... does not appear from the second click in one of those header links. But it does appear on the first click in any of those links.



The thing is that I heard that dynamic urls are bad for search engines to crawl at them and then I thought that I might do something to avoid this dynamic url since search engines has not been very keen on this site so far.

The thing is that I am using the sessions to keep the state of an email that might have been started by the user in the Contact page. That way if the user leaves that contact page but comes back later, he would find the text written as he left it instead of having to write the email from the beginning.

Thank you very much.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: remove PHPSESSID=.... from URL

Post by califdon »

Instead of passing the ID in the URL (GET method), how about using a hidden <input> field and passing it as POST method?
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

Re: remove PHPSESSID=.... from URL

Post by thosecars82 »

califdon wrote:Instead of passing the ID in the URL (GET method), how about using a hidden <input> field and passing it as POST method?
Well, I already solved this by writing this into the header.php file:
<?php
ini_set("url_rewriter.tags","");
session_start();
Thanks though.
For the time being, I would like to change another dynamic part from my url into a static url. That part is the one involving either the ?language=sp or the ?language=en string. Does any of you know how to tackle this problem? You should bear in mind that my hosting provider told me that they cannot enable the mod_rewrite. It tell you this because if am not wrong, this assumption does not leave place for the solution consisting on placing some code in the .htaccess file. Please, correct me if I am wrong.
solve this problem by placing some code i. Do you have any suggestion?
Thans in advance.
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

Re: remove PHPSESSID=.... from URL

Post by thosecars82 »

thosecars82 wrote:
califdon wrote:Instead of passing the ID in the URL (GET method), how about using a hidden <input> field and passing it as POST method?
Well, I already solved this by writing this into the header.php file:
<?php
ini_set("url_rewriter.tags","");
session_start();
Thanks though.
For the time being, I would like to change another dynamic part from my url into a static url. That part is the one involving either the ?language=sp or the ?language=en string. Does any of you know how to tackle this problem? You should bear in mind that my hosting provider told me that they cannot enable the mod_rewrite. It tell you this because if am not wrong, this assumption does not leave place for the solution consisting on placing some code in the .htaccess file. Please, correct me if I am wrong.
solve this problem by placing some code i. Do you have any suggestion?
Thans in advance.
Well, it seems that I was wrong because they just told me that the mod_rewrite is enabled. Anyways, I would appreciate if anybody could tell me some way to check this by myself. But do you have any suggestion for the code I could place into my .htaccess file to make my urls static?
It's just that I tried with this

Options +FollowSymLinks
RewriteEngine on
RewriteRule /home/language/(.*) home.php?language=$1
RewriteRule /home/language/(.*)/ home.php?language=$1

but it does not make any difference in the remote server because I still see the dynamic part of the URL.
Therefore, do you have any suggestion to make it work?
Thanks in advance
Thanks in advance
thosecars82
Forum Commoner
Posts: 94
Joined: Thu Apr 03, 2008 6:31 am
Location: Arganda, Madrid
Contact:

Re: remove PHPSESSID=.... from URL

Post by thosecars82 »

Thanks
I eventually solved it with something like this:
RewriteEngine on

RewriteRule ^home/language/(.*) home.php?language=$1
RewriteRule ^home/language/(.*)/ home.php?language=$1
RewriteRule ^home home.php
RewriteRule ^home/ home.php

The only problem now is that with safari and firefox the two flash animations that I have on the first page do not show up when the language is changed right after entering into the site. Nonetheless, this does not happen in ie6. I am trying to fix this now.
Post Reply