Simple Machines Community Forum

SMF Development => Feature Requests => Applied or Declined Requests => Topic started by: Off Da HuyChoK on March 17, 2006, 01:57:01 AM

Title: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: Off Da HuyChoK on March 17, 2006, 01:57:01 AM
example.com/node?PHPSESSID=7dd1d5d1471fa8be2fea8f163cce3257  >:( :'(

Tired of that ^^^^ ??

.. me too, i think I got it figured out below

       |
       |
    \  |  /
     \ | /
      \ /
Title: Re: READ THIS: Remove PHPSSID from URL
Post by: Off Da HuyChoK on March 17, 2006, 04:51:12 PM
OK I got it figured out..

http://www.hyperky.com/sitemaps.php
http://www.hyperky.com/urllist.php

I had to edit my .htaccess, modify the google sitemaps mod, and modify some of the SMF code.

Next stop, I will get this working with TP portal MOD!  8)


I will post the instructions here if requested.
Title: Re: READ THIS: Remove PHPSSID from URL
Post by: vbgamer45 on March 17, 2006, 10:18:48 PM
Post it please haven't really had time to really look into this yet.
Title: Re: READ THIS: Remove PHPSSID from URL
Post by: Off Da HuyChoK on March 18, 2006, 03:14:01 AM
THIS IS WITH TP SUPPORT, IF YOU DONT HAVE TP THEN DONT MODIFY/ADD/OR REPLACE ANYTHING WITH THE WORD "ARTICLE" IN IT, then you should be ok  ;)


DISABLE FRIENDLY URLS FIRST, u wont need them any more  ;D

Add this to .htaccess :
=================
<IfModule mod_php4.c>
php_value session.use_trans_sid 0
</IfModule>

RewriteEngine On
RewriteBase /

RewriteRule ^index.html index.php [L]
RewriteRule ^board([0-9.]*).html index.php?board=$1.0 [L]
RewriteRule ^topic([0-9.]*).html index.php?topic=$1.0 [L]
RewriteRule ^article([0-9.]*).html index.php?page=$1 [L]
RewriteRule ^profile([0-9.]*).html index.php?action=profile;u=$1 [L]


sitemaps.php by Davilac (http://www.davilac.net)
===================
FIND:
--------------------------------------------------------
   $members[] = array(
      'id' => $row['ID_MEMBER'],
      'times' => $member_post_times,
   );
}

mysql_free_result($request);
--------------------------------------------------------
ADD AFTER: -TP ONLY-
--------------------------------------------------------
$request = db_query("
   SELECT ID
   FROM {$db_prefix}tp_articles", __FILE__, __LINE__);
$articles = array();
while ($row = mysql_fetch_assoc($request))
{
   $articles[] = array(
      'id' => $row['ID'],
      );
}
mysql_free_result($request);
--------------------------------------------------------
FIND:
--------------------------------------------------------
// Popular topics too...
if ($modSettings['queryless_urls']==0){
--------------------------------------------------------
ADD BEFORE: -TP ONLY- lol  :D
--------------------------------------------------------
// The Articles (adds support for sitemaps in Tiny Portal)
foreach ($articles as $article)

   echo '
   <url>
      <loc>', $scripturl, "article", $article['id'], '.html</loc>
      <lastmod>', posts_max_time($board['times']), '</lastmod>
      <changefreq>daily</changefreq>
      <priority>', posts_to_priority(0.9, $board['times']), '</priority>
   </url>';
--------------------------------------------------------
FIND                     >>>       REPLACE WITH:  (EXACTLY AS BELOW, WITH QUOTES)
--------------------------------------------------------
$scripturl       ALL      >>>        "http://www.YOURSITE.com/YOURFORUM"
'?board='                  >>>        "board"
'/board,'                   >>>         "board"
'?topic='                   >>>         "topic"
'/topic,'                    >>>         "topic"
'?action=profile;u='     >>>         "profile"
], '.0          ALL          >>>         ], '.html
], '.0.html    ALL          >>>         ], '.html
$member['id'], '</loc>      >>>             $member['id'], '.html</loc>
---------------------------------------------------------

robots.txt
---------
User-agent: Googlebot
Disallow: /*PHPSESSID
Disallow: /*?

User-agent: *

Disallow: /data/
Disallow: /avatars/
Disallow: /attachments/
Disallow: /tp-downloads/
Disallow: /Packages/
Disallow: /Sources/
Disallow: /Themes/
Disallow: /Smileys/
Disallow: /wysiwyg/

Disallow: /Settings.php
Disallow: /Settings_bak.php
Disallow: /SSI.php
Disallow: /ssi_examples.shtml
Disallow: /ssi_examples.php
------------------------------



Sorry about the mess, im not good at writing guides, but ill try to revise when I have time.  This definetly works..

look at my sitemaps:

http://www.hyperky.com/sitemaps.php
http://www.hyperky.com/urllist.php

GOOD LUCK, ILL BE HELPING MORE TOMOROW!
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: sbarnes on April 20, 2006, 04:34:36 AM
Hi there,
I have followed all instructions to the letter except that I could not find any ], '.0.html in my file.

I am getting a load of notices on my generated page.

Please see: http://www.pick-your-brains.co.uk/sitemaps/index.php

Any idea how I can make this normal? or what the problem is? will it still work if submitted to google?

It is just the index.php which has these errors the others are fine.
http://www.pick-your-brains.co.uk/sitemaps/sitemaps.php
http://www.pick-your-brains.co.uk/sitemaps/urllist.php

Also the first edit:
Do you add that to the existing htaccess file in the sitemaps folder or replace it with?
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: Stüldt Håjt on April 20, 2006, 07:24:14 AM
Doesn't seem to help...
http://www.pick-your-brains.co.uk/index.php?PHPSESSID=d9aa71c1215502126603f207c71d12b2&topic=22.0
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: sbarnes on April 20, 2006, 12:47:12 PM
Sorry I dont get what you are telling me.

Are you saying that the mod is interfering with the sitemap stuff?

How comes the link you supplied has session info?, links I see dont?
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: Stüldt Håjt on April 20, 2006, 09:02:49 PM
Im saying that this "Remove PHPSSID from URL" doesn't work as I see a session id in your forum.
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: sbarnes on April 21, 2006, 05:26:39 AM
oh right, thanks.
That is weird tho because I dont see links that, is this normal?

And why would this mod for sitemaps alter the working of the site.

All edited files are within the sitemaps folder. Am I missing something?
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: Stüldt Håjt on April 21, 2006, 06:27:27 AM
I picked that url from http://www.pick-your-brains.co.uk/sitemaps/index.php.
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: sbarnes on April 21, 2006, 03:29:32 PM
see, I dont get this.

If I goto http://www.pick-your-brains.co.uk/sitemaps/index.php.
and copy that link I get:
http://www.pick-your-brains.co.uk/index.php?topic=22.0

What does everyone get?

Also the first edit:
Do you add that to the existing htaccess file in the sitemaps folder or replace it with? is the htaccess in the sitemaps folder or the root?
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: Stüldt Håjt on April 21, 2006, 08:32:29 PM
Log out and delete your forums cookie from your browser and go to there again and you will see sessid.

But I don't think that is a problem with Google, because if you use Googlebot user agent you won't see sessids...
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: oSa on April 25, 2006, 04:14:02 PM
I've tried this method, my sitemap is errorfree but when i copy/paste the urls form the sitemap i get "page not found" errors. In the first post of this thread it says "DISABLE FRIENDLY URLS FIRST, u wont need them any more" but it doesn't seem to work with this option disabled. And i think my host doesn't support mod_rewrite so i can't enable it either. What should i do, just submit the sitemap with links like "http://osa.buildtolearn.net/forum/index.php?board=1.0" ?

Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: Oldiesmann on April 26, 2006, 05:13:04 PM
Turning off the session.use_trans_sid (http://www.php.net/ref.session#ini.session.use-trans-sid) option in php.ini will usually remove PHPSESSID from the URLs.

For those who don't have access to php.ini, either ask your host to do it (tell them that it's a security risk to have the session ID displayed in the URL like that) or use ini_set() (http://www.php.net/ini_set) to turn it off (add ini_set('session.use_trans_sid', 0); to the beginning of index.php). If your host has disabled ini_set, you should probably find a new host who knows what they're doing...

Also, enabling the session.use_only_cookies (http://www.php.net/ref.session#ini.session.use-only-cookies) option can make things more secure as well...
Title: Re: READ THIS: Remove PHPSSID from URL (FOR SITEMAPS with TP support)
Post by: Ben_S on April 26, 2006, 05:14:31 PM
If you are using 1.1 RC2 or later, SMF will not start session ID's for bots (code is in Load.php).