[Revised] vBulletin Mod_rewrite Tutorial

Reply

Join Date: Apr 2005
Posts: 4
Reputation: notepad is an unknown quantity at this point 
Solved Threads: 0
notepad notepad is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #111
Apr 16th, 2005
Problem solved. I just added keith's mod_rewrite_title function to functions.php then replaced my TEST MOD in the construct_page_nav function with:

  1. // MOD by Chad (4/16/05) ************
  2. global $threadid, $threadinfo;
  3. $threadTitle = $threadinfo['title'];
  4. $tpURL = 't'.$threadid.'p'.$curpage.'-'.mod_rewrite_title($threadTitle);
  5. // END MOD **************************

Works like a charm and now I have keyword links to all pages.

- Chad
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 11
Reputation: berlin is an unknown quantity at this point 
Solved Threads: 0
berlin berlin is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #112
Apr 17th, 2005
Nice that you got it to work although I'm lost. If you have time, please post the instructions like Keith did. thanks!
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 5
Reputation: Dean C is an unknown quantity at this point 
Solved Threads: 0
Dean C's Avatar
Dean C Dean C is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #113
Apr 20th, 2005
Hey guys,

Just to let you know I've achieved this efficiently solely with one template edit. The thing that put me off installing this mod in the first place was the file edits as I'm trying not to modify my source at all. I'll be writing an article on it soon and publishing it

Regards,
- Dean
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 18
Reputation: agiacosa is an unknown quantity at this point 
Solved Threads: 0
agiacosa agiacosa is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #114
Apr 20th, 2005
Dean,

You're going to make us wait!!
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 11
Reputation: RodneyB is an unknown quantity at this point 
Solved Threads: 0
RodneyB RodneyB is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #115
Apr 23rd, 2005
So has anybody posted a revised version of this mod_rewrite hack (Keith's version) with all the fixes in it so that it works with vb 3.0.7?
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 18
Reputation: agiacosa is an unknown quantity at this point 
Solved Threads: 0
agiacosa agiacosa is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #116
Apr 23rd, 2005
I did. Dani, please delete this post if inappropriate.

##############################################################
## MOD Title: Revised vBulletin 3.X Mod-Rewrite
## MOD Authors: Dani, KeithMcL, Ted S
## Contributor: agiacosa http://www.aquaticplantcentral.com
## MOD Description: make your vBulletin forum search engine spiderable - for Google and all the others
## MOD Version: 1.0.0
##
## Installation Level: moderate
## Installation Time: 20 Minutes
## Files To Edit (5): showthread.php
## forumdisplay.php
## search.php
## includes/functions_forumlist.php
## includes/functions_online.php
##
## Templates To Edit (8): forumhome_forumbit_level1_nopost
## forumhome_forumbit_level1_post
## forumhome_forumbit_level2_nopost
## forumhome_forumbit_level2_post
## forumhome_subforumbit_nopost
## forumhome_subforumbit_post
## forumhome_lastpostby
## threadbit
##
## New Files (1): .htaccess
##
##############################################################
## For Security Purposes, Please Check: http://www.daniweb.com/techtalkforums/thread17549.html
## for the latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your Forum.
##############################################################
## Author Notes:
##
## Requires: mod-rewrite - check with you host to make sure you have it enabled
##
##############################################################
## MOD History:
##
## 2005-04-01 - Version 1.0.0
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ CREATE .htaccess file and upload to forum root directory]--
#
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^t([0-9]+)-(.*).html$ showthread.php?t=$1 [L]
RewriteRule ^lastpostinthread([0-9]+).html$ showthread.php?goto=lastpost&t=$1 [L]
RewriteRule ^newpostinthread([0-9]+).html$ showthread.php?t=$1 [L]
RewriteRule ^f([0-9]+)-(.*).html$ forumdisplay.php?forumid=$1 [L]
#
#-----[ OPEN ]------------------------------------------
#
forumdisplay.php
#
#-----[ FIND ]------------------------------------------
#
foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache["$forumID"]['title'];
$navbits["forumdisplay.php?$session[sessionurl]f=$forumID"] = $forumTitle;
}
#
#-----[ REPLACE WITH ]----------------------------------
#
// ################ MOD_REWRITE HACK ######################
foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache["$forumID"]['title'];
$forumURL = strtolower(str_replace(" ", "-",str_replace("/", "-", $forumTitle)));
$navbits["f$forumID-$forumURL.html"] = $forumTitle;
}
// ################ MOD_REWRITE HACK ######################
#
#-----[ FIND ]------------------------------------------
#
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
#
#-----[ AFTER, ADD ]------------------------------------
#
// ################ MOD_REWRITE HACK ######################
$thread['url'] = strtolower(str_replace(" ", "-", $thread['threadtitle']));
$thread['url'] = ereg_replace("[\/!£$%^&*«»,.;:'#@~{}|=+`¬<>?]+", "", $thread['url']);
// ################ MOD_REWRITE HACK ######################
#
#-----[ OPEN ]------------------------------------------
#
showthread.php
#
#-----[ FIND ]------------------------------------------
#
foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache["$forumID"]['title'];
$navbits["forumdisplay.php?$session[sessionurl]f=$forumID"] = $forumTitle;
}
#
#-----[ REPLACE WITH ]----------------------------------
#
// ################ MOD_REWRITE HACK ######################
foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache["$forumID"]['title'];
$forumURL = strtolower(str_replace(" ", "-",str_replace("/", "-", $forumTitle)));
$navbits["f$forumID-$forumURL.html"] = $forumTitle;
}
// ################ MOD_REWRITE HACK ######################
#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND ]------------------------------------------
#
$thread = process_thread_array($thread, $lastread["$thread[forumid]"]);
#
#-----[ AFTER, ADD ]------------------------------------
#
// ################ MOD_REWRITE HACK ######################
$thread['url'] = strtolower(str_replace(" ", "-", $thread['threadtitle']));
$thread['url'] = ereg_replace("[\/!£$%^&*«»,.;:'#@~{}|=+`¬<>?]+", "", $thread['url']);
// ################ MOD_REWRITE HACK ######################
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_formlist.php
#
#-----[ FIND ]------------------------------------------
#
// do light bulb
$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
#
#-----[ BEFORE, ADD ]-----------------------------------
#
// ################ MOD_REWRITE HACK ######################
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
$forum['url'] = ereg_replace("[\/!£$%^&*«»,.;:'#@~{}|=+`¬<>?]+", "", $forum['url']);
// ################ MOD_REWRITE HACK ######################
#
#-----[ FIND THIRD INSTANCE OF]-------------------------
#
$forumperms = $bbuserinfo['forumpermissions']["$forumid"];
#
#-----[ BEFORE, ADD ]-----------------------------------
#
// ################ MOD_REWRITE HACK ######################
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
$forum['url'] = ereg_replace("[\/!£$%^&*«»,.;:'#@~{}|=+`¬<>?]+", "", $forum['url']);
// ################ MOD_REWRITE HACK ######################
#
#-----[ OPEN ]------------------------------------------
#
includes/functions_online.php
#
#-----[ FIND ]------------------------------------------
#
// ###################### Start showonline #######################
#
#-----[ BEFORE, ADD ]-----------------------------------
#
// ###################### MOD_REWRITE HACK #################
function mod_rewrite_title($title)
{
$rewritten = strtolower(str_replace(" ", "-",str_replace("/", "-", $title)));
return ereg_replace("[\/!£$%^&*«»,.;:'#@~{}|=+`¬<>?]+", "", $rewritten);
}
// ###################### MOD_REWRITE HACK #################
#
#-----[ FIND ALL INSTANCES]-----------------------------
#
<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>
#
#-----[ REPLACE ALL WITH ]------------------------------
#
<a href=\"t$threadid-" .mod_rewrite_title($threadtitle). ".html\" title=\"$threadpreview\">$threadtitle</a>
#
#-----[ FIND ALL INSTANCES]-----------------------------
#
<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>
#
#-----[ REPLACE ALL WITH ]------------------------------
#
<a href=\"f$forumid-" .mod_rewrite_title($forumtitle). ".html\">$forumtitle</a>
#
#-----[ FIND ]------------------------------------------
#
convert_short_varnames($values);

$userinfo['values'] = $values;
#
#-----[ AFTER, ADD ]------------------------------------
#
// #################### MOD_REWRITE HACK #################
if (eregi("t([0-9]+)-(.*).html$", $filename, $tmatch)) {
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}

if (eregi("f([0-9]+)-(.*).html$", $filename, $fmatch)) {
$filename = 'forumdisplay.php';
$values['forumid'] = $fmatch[1];
}
// #################### MOD_REWRITE HACK #################
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/FORUM HOME TEMPLATES/forumhome_forumbit_level1_nopost
#
#-----[ FIND ]------------------------------------------
#
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="f$forum[forumid]-$forum[url].html">
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/FORUM HOME TEMPLATES/forumhome_forumbit_level1_post
#
#-----[ FIND ]------------------------------------------
#
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="f$forum[forumid]-$forum[url].html">
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/FORUM HOME TEMPLATES/forumhome_forumbit_level2_nopost
#
#-----[ FIND ]------------------------------------------
#
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="f$forum[forumid]-$forum[url].html">
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/FORUM HOME TEMPLATES/forumhome_forumbit_level2_post
#
#-----[ FIND ]------------------------------------------
#
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="f$forum[forumid]-$forum[url].html">
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/FORUM HOME TEMPLATES/forumhome_subforumbit_nopost
#
#-----[ FIND ]------------------------------------------
#
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="f$forum[forumid]-$forum[url].html">
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/FORUM HOME TEMPLATES/forumhome_subforumbit_post
#
#-----[ FIND ]------------------------------------------
#
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="f$forum[forumid]-$forum[url].html">
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/FORUM HOME TEMPLATES/forumhome_lastpostby
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]goto=newpost&amp;t=$lastpostinfo[lastthreadid]" title="<phrase 1="$lastpostinfo[lastthread]">$vbphrase[go_first_unread_in_thread_x]</phrase>"><strong>$lastpostinfo[trimthread]</strong></a>
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="newpostinthread$lastpostinfo[lastthreadid].html" title="<phrase 1="$lastpostinfo[lastthread]">$vbphrase[go_first_unread_in_thread_x]</phrase>"><strong>$lastpostinfo[trimthread]</strong></a>
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]goto=lastpost&amp;t=$lastpostinfo[lastthreadid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="lastpostinthread$lastpostinfo[lastthreadid].html"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]goto=lastpost&amp;t=$lastpostinfo[lastthreadid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="lastpostinthread$lastpostinfo[lastthreadid].html"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a>
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/THREADBIT TEMPLATES/threadbit
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]goto=lastpost&amp;t=$thread[threadid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="lastpostinthread$thread[threadid].html">
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]goto=newpost&amp;t=$thread[threadid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="newpostinthread$thread[threadid].html">
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="t$thread[threadid]-$thread[url].html">
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]goto=lastpost&amp;t=$thread[threadid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="lastpostinthread$thread[threadid].html">
#
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
#
#-----[ vBAdvanced CMPS Mod ADD-ON]---------------------
#
#-----[ OPEN ]------------------------------------------
#
modules/latesttopics.php
#
#-----[ FIND ]------------------------------------------
#
$thread = process_thread_array($thread, '', $vba_options['portal_threads_showicon']);
#
#-----[ AFTER, ADD ]------------------------------------
#
// ################ MOD_REWRITE HACK ######################
$thread['url'] = strtolower(str_replace(" ", "-", $thread['title']));
$thread['url'] = ereg_replace("[\/!£$%^&*«»,.;:'#@~{}|=+`¬<>?]+", "", $thread['url']);
// ################ MOD_REWRITE HACK ######################
#
#-----[ OPEN ]------------------------------------------
#
AdminCP/vBADVANCED CMPS TEMPLATES/adv_portal_latesttopicbits
#
#-----[ FIND ]------------------------------------------
#
showthread.php?t=$thread[threadid]
#
#-----[ REPLACE WITH ]----------------------------------
#
t$thread[threadid]-$thread[url].html
#
#-----[ FIND ]------------------------------------------
#
showthread.php?t=$thread[threadid]
#
#-----[ REPLACE WITH ]----------------------------------
#
t$thread[threadid]-$thread[url].html
#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
#
# EoM
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 4
Reputation: notepad is an unknown quantity at this point 
Solved Threads: 0
notepad notepad is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #117
Apr 23rd, 2005
Originally Posted by Dean C
Just to let you know I've achieved this efficiently solely with one template edit. ... I'll be writing an article on it soon and publishing it
You're killing me Dean! At least give us a little to chew on!

- Chad
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 11
Reputation: RodneyB is an unknown quantity at this point 
Solved Threads: 0
RodneyB RodneyB is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #118
Apr 23rd, 2005
Originally Posted by agiacosa
I did. Dani, please delete this post if inappropriate.
Thanks agiacosa!

So that version has all the major fixes posted in this thread? Wow, it's even in easy to read phpbb mod format. Thanks!
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 18
Reputation: agiacosa is an unknown quantity at this point 
Solved Threads: 0
agiacosa agiacosa is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #119
Apr 24th, 2005
Yes. I went through threads here and at The Admin Zone.
Reply With Quote Quick reply to this message  
Join Date: Apr 2005
Posts: 5
Reputation: Dean C is an unknown quantity at this point 
Solved Threads: 0
Dean C's Avatar
Dean C Dean C is offline Offline
Newbie Poster

Re: [Revised] vBulletin Mod_rewrite Tutorial

 
0
  #120
Apr 25th, 2005
Originally Posted by notepad
You're killing me Dean! At least give us a little to chew on!

- Chad
Well it's compatible with forumdisplay, showthread, showthread-pages and similar threads The only thing I'm having problems with is who-online. I'm trying to keep this to only one-templated you see. Everything is working apart from the who's online

I've done some benchmarks too as far as processing time goes and it's extremely efficient.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC