•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 391,771 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,257 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 34995 | Replies: 131
![]() |
•
•
Join Date: Apr 2005
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
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:
Works like a charm and now I have keyword links to all pages.
- Chad
// MOD by Chad (4/16/05) ************ global $threadid, $threadinfo; $threadTitle = $threadinfo['title']; $tpURL = 't'.$threadid.'p'.$curpage.'-'.mod_rewrite_title($threadTitle); // END MOD **************************
Works like a charm and now I have keyword links to all pages.
- Chad
•
•
Join Date: Mar 2005
Posts: 18
Reputation:
Rep Power: 4
Solved Threads: 0
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&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&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&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&t=$thread[threadid]">
#
#-----[ REPLACE WITH ]----------------------------------
#
<a href="lastpostinthread$thread[threadid].html">
#
#-----[ FIND ]------------------------------------------
#
<a href="showthread.php?$session[sessionurl]goto=newpost&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&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
•
•
•
•
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.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
- vBulletin mod_rewrite (PHP)
Other Threads in the PHP Forum
- Previous Thread: using php to check for filenames
- Next Thread: Interesting, yet probably simple, PHP Nuke Error


Linear Mode