View Single Post
  #223  
Old 01-30-2003, 09:16 AM
lierduh lierduh is offline
 
Join Date: Jan 2003
Location: Sydney, Australia
Posts: 459
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Edit: 13 Dec 2003, posted some notes about VB version 3 Beta 7.

https://vborg.vbsupport.ru/showpost....&postcount=298

Edit: 26 July 2003, buro9 has found and fixed quite a few bugs, he has also made improvement. Please refer to his post at:

https://vborg.vbsupport.ru/showthrea...257#post418257

Edit: 9 Feb 2003, added RewriteCond to fix search result navigation problem.

Edit: 5 Feb 2003, added RewriteCond to fix member list navigation problem.

Edit: 2 Feb 2003, added hack to the forums/threads page navigation links to cover more threads. Change made to pagenumber and perpage's position from my initial post.
===========

I will share my experience with this hack.
My web server is running apache.

First of all, your web server needs to have mod_rewrite module installed and enabled.

I put rewrite rules in .htaccess (in httpd.conf should be the same)
I decided not to use session ID. I will explain this later.

First, for .htaccess to work, you need to enable it with "AllowOverride" in your httpd.conf file. My AllowOverride line looks like this:

AllowOverride AuthConfig Options FileInfo

Naturally
AllowOverride All
will work too.

For Redhat and Mandrake Linux, httpd.conf file is located under:
/etc/httpd/conf/

If you don't know where is yours, try:
#locate httpd.conf

For those of you who can not access to httpd.conf file, eg. use someone else's server etc, .htaccess is a better option.

I use .htaccess for different settings including php options for different software. You may only want rewrite rules for a certain software, not everything under the same domain!

My rewrite rules extracted from .htaccess:

RewriteEngine on
RewriteRule ^f([0-9]+)\.html$ forumdisplay.php?forumid=$1 [L]
RewriteRule ^f([0-9]+)-([0-9]+)\.html$ forumdisplay.php?forumid=$1&daysprune=30&sortorder =&sortfield=lastpost&perpage=25&pagenumber=$2 [L]
RewriteRule ^t([0-9]+)\.html$ showthread.php?threadid=$1 [L]
RewriteRule ^t([0-9]+)-([0-9]+)-([0-9]+)\.html$ showthread.php?threadid=$1&perpage=$2&pagenumber=$ 3 [L]
RewriteRule ^t([0-9]+)-([0-9]+)--(.*)--([0-9]+)\.html$ showthread.php?threadid=$1&perpage=$2&highlight=$3 &pagenumber=$4 [L]

RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^memberlist.php$ memberlist.php?%1&pagenumber=%2? [L]
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^search.php$ search.php?%1&pagenumber=%2? [L]


Why don't I use session ID?

The Googlebots hate the most is session ID. As soon as they remotely detect there is an session id, they turn around and go away. This is why no vBulletin boards will be indexed. I have got a feeling that if the session id is removed, even with no rewrite hack and with the "?" in the URL, google will index the forums. The reason why Googlebots do not like session ID is: Each time the bot visits, for the same contents, it will be fed with different URL. Sometimes more than one bots might visit at the same time. They might be pulling the same page with different URL! I also believe Google punishes with lowered PR rating for those web sites that have different URLs for the same page. So even if you do rewrite session IDs as part of URL, the bots will get different URLs for the same page, when they process the data and find out, they will give your site a lowered PR rating, with passion! as your site has wasted a lot of their time.

The second reason for not using session ID is security. Imagine this, you have your cookies turned off, you go to this forums, log in and find something good, you subsequently copy the URL of one of the thread and paste in a post. As the session ID carries your Logged in ID. Now if someone else who has not even logged in click on the URL you just posted, he becomes you, he can then post under your name! Tell this to your members, then you will have no problem forcing them to turn on the cookies.

You will notice for the forums, I also use .html as the forums page instead of the original directory structure for the forums. Google lowers PR rating for each directory layer, so don't let the "/" get in the way. Also with "/", you will have image display problems etc. As the displayforums.php is in the root directly, now your page is "/f10298740/" .

The following templates need to be changed:

forumdisplay_forumbit_level1_nopost
forumdisplay_forumbit_level1_post
forumdisplay_forumbit_level2_nopost
forumdisplay_forumbit_level2_post
forumhome_forumbit_level1_nopost
forumhome_forumbit_level1_post
forumhome_forumbit_level2_nopost
forumhome_forumbit_level2_post
usercp_forumbit

Find
forumdisplay.php?s=$session[sessionhash]&forumid=$forum[forumid]

Replace it with:
f$forum[forumid].html

For forumdisplaybit template,

Replace
<a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]">$thread[title]</a>

with
<a href="t$thread[threadid].html">$thread[title]</a>

For forumdisplay_multipagenav_pagenumber

Replace
<a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]&perpage=$pperpage&pagenumber=$acurpage">$acurpage </a>

with
<a href="t$thread[threadid]-$pperpage-$acurpage.html">$acurpage</a>

To fix "Who is online" problem.

In online.php, find:

$loc=preg_replace("/\?s=[a-z0-9]{32}(&)?/","?",$loc);

add the following lines:

$loc=preg_replace("/f(\d+).html/","forumdisplay.php?forumid=\$1",$loc);
$loc=preg_replace("/t(\d+).html/","showthread.php?threadid=\$1",$loc);
$loc=preg_replace("/t(\d+)-(\d+)-(\d+).html/","showthread.php?threadid=\$1",$loc);

I will post more information when I find more problems with the hack. Hope my experience helps someone.

========= Edit: added the hack for forumdisplay.php navigation links

Fix Forums Navigation links:

open forumdisplay.php

Find
$pagenav =
getpagenav($totalthreads,"forumdisplay.php?s=$sess ion[sessionhash]&forumid=$forumid&daysprune=$daysprune&sortorder=$ sortorder&sortfield=$sortfield&perpage=$perpage");

replace it with:
$pagenav = getpagenav($totalthreads,"f$forumid");


Change the following templates as well.

pagenav_firstlink
find: <a href="$address&pagenumber=$curpage" title="first page">
change to: <a href="$address-$curpage.html" title="first page">

pagenav_lastlink
find: <a href="$address&pagenumber=$curpage" title="last page">
change to: <a href="$address-$curpage.html" title="last page">

pagenav_nextlink
find: <a href="$address&pagenumber=$nextpage" title="next page">
change to: <a href="$address-$nextpage.html" title="next page">

pagenav_pagelink
find: <a href="$address&pagenumber=$curpage">$curpage</a>
change to: <a href="$address-$curpage.html">$curpage</a>

pagenav_prevlink
find: <a href="$address&pagenumber=$prevpage" title="previous page">&laquo;</a>
change to: <a href="$address-$prevpage.html" title="previous page">&laquo;</a>

=============
Open showthread.php

find:
$pagenav = getpagenav($totalposts,"showthread.php?s=$session[sessionhash]&threadid=$threadid&perpage=$perpage".iif(isset($h ighlight), "&highlight=$highlight", ""));

change it to:

$pagenav = getpagenav($totalposts,"t$threadid-$perpage".iif(isset($highlight),"--$highlight-", ""));
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01312 seconds
  • Memory Usage 1,802KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete