I figured it was about time I updated my mod_rewrite tutorial for vBulletin. Therefore, I decided to provide you guys with the exact, full mod_rewrite that I use here at DaniWeb. It's written for a clean install of vB 3.0.7. This version is not for the faint of heart!
Some new features you can expect to find in this version, that aren't in previous versions, included multi-page support, support for linear, hybrid, and threaded thread modes, full support in the who's online (no more Unknown Locations!), previous / next thread links, and much more!
Attached is my massive .htaccess file. Rename it .htaccess and upload it to your forum directory. Also attached is an .xml file that contains all of the templates that need to be changed. They are already fully edited. Use the vB Admin Panel to create a new style out of the attached XML file. Then, simply edit it as you'd like. :) However, for the most part, CSS customizations will do - most of what I accomlish at DaniWeb is mere changing the CSS and the header and footer templates.
Below are the PHP files that need to be edited. You will notice two lines at a time. The first line represents what to search for, and the second line represents what to replace it with.
<< update >>
This hack is now obsolete! Please visit the new version:
http://www.daniweb.com/techtalkforums/thread35147.html
<< end update >>
So without further ado ...
forumdisplay.php
$navbits["forumdisplay.php?$session[sessionurl]f=$forumID"] = $forumTitle;
$navbits["forum$forumID.html"] = $forumTitle; // edited by Dani
$announcementidlink = iif(!$vboptions['oneannounce'] , "&announcementid=$announcement[announcementid]");
$announcementidlink = iif(!$vboptions['oneannounce'] , "-$announcement[announcementid]");
$pagenav = construct_page_nav($totalthreads, "forumdisplay.php?$session[sessionurl]f=$forumid", "&sort=$sortfield&order=$sortorder&pp=$perpage&daysprune=$daysprune");
$pagenav = construct_page_nav($totalthreads, "forum$forumid", "-$sortfield-$sortorder-$perpage-$daysprune.html");
search.php
$highlightwords = '&highlight=' . urlencode(implode(' ', $display['highlight']));
$highlightwords = '-' . urlencode(implode(' ', $display['highlight']));
$display['forums']["$key"] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\"><b><u>" . $forumcache["$forumid"]['title'] . '</u></b></a>';
$display['forums']["$key"] = "<a href=\"forum$forumid.html\"><b><u>" . $forumcache["$forumid"]['title'] . '</u></b></a>';
showthread.php
$highlightwords = iif($goto, '&', '&') . 'highlight=' . urlencode($_GET['highlight']);
$highlightwords = '-' . urlencode($_GET['highlight']);
exec_header_redirect("showthread.php?$session[sessionurl_js]p=$getlastpost[postid]$highlightwords#post$getlastpost[postid]");
exec_header_redirect("threadedpost$getlastpost[postid]$highlightwords.html#post$getlastpost[postid]");
exec_header_redirect("showthread.php?$session[sessionurl_js]p=$posts[postid]$highlightwords#post$posts[postid]");
exec_header_redirect("threadedpost$posts[postid]$highlightwords.html#post$posts[postid]");
exec_header_redirect("showthread.php?$session[sessionurl_js]t=$threadinfo[threadid]&goto=lastpost$highlightwords");
exec_header_redirect("lastpostinthread$threadinfo[threadid]$highlightwords.html");
exec_header_redirect("showthread.php?$session[sessionurl_js]t=$thread[pollid]");
exec_header_redirect("thread$thread[pollid].html");
$pagenav = construct_page_nav($totalposts, "showthread.php?$session[sessionurl]t=$threadid", "&pp=$perpage$highlightwords");
$pagenav = construct_page_nav($totalposts, "threadnav$threadid", "-$perpage$highlightwords.html");
$firstunread = 'showthread.php?' . $session['sessionurl'] . 't=' . $threadid . '&goto=newpost';
$firstunread = 'newpostinthread' . $threadid . '.html';
$pagenav = construct_page_nav($numhybrids, "showthread.php?$session[sessionurl]p=$_REQUEST[postid]", "&pp=$perpage$highlightwords");
$pagenav = construct_page_nav($numhybrids, "post$_REQUEST[postid]", "-$perpage$highlightwords.html");
$navbits["forumdisplay.php?$session[sessionurl]f=$forumID"] = $forumTitle;
$navbits["forum$forumID.html"] = $forumTitle;
clientscript/vbulletin_thrdpostlist.js
window.location = "showthread.php?" + SESSIONURL + "postid=" + postid + "#poststop";
window.location = "post" + postid + ".html#poststop";
document.write('<a href="showthread.php?postid=' + postid + highlightwords + '#post' + postid + '" id="link' + postid + '"><i>' + morephrase + '</i></a></div>\n');
document.write('<a href="threadedpost' + postid + highlightwords + '.html#post' + postid + '" id="link' + postid + '"><i>' + morephrase + '</i></a></div>\n');
document.write('<a href="showthread.php?postid=' + postid + highlightwords + '#post' + postid + '" onclick="return showPost(' + postid + ')" id="link' + postid + '"' + titlestyle + '>' + title + '</a> ');
document.write('<a href="threadedpost' + postid + highlightwords + '.html#post' + postid + '" onclick="return showPost(' + postid + ')" id="link' + postid + '"' + titlestyle + '>' + title + '</a> ');
includes/functions_forumdisplay.php
$address = "showthread.php?$session[sessionurl]t=$thread[threadid]";
$address = "threadnav$thread[threadid]";
$address2 = "$thread[highlight]";
$address2 = "-$vboptions[maxposts]$thread[highlight].html";
includes/functions_online.php
$userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"thread$threadid.html\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"showthread.php?$session[sessionurl]p=$postid#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"post$postid.html#post$postid\" title=\"$threadpreview\">$threadtitle</a>";
$userinfo['where'] = "<a href=\"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>";
$userinfo['where'] = "<a href=\"forum$forumid.html\">$forumtitle</a>";
Also, in functions_online.php, after
$userinfo['values'] = $values;
insert
// added by dani for seo hack
if (eregi("thread([0-9]+).html$", $filename, $tmatch))
{
$filename = 'showthread.php';
$values['threadid'] = $tmatch[1];
}
if (eregi("forum([0-9]+).html$", $filename, $fmatch))
{
$filename = 'forumdisplay.php';
$values['forumid'] = $fmatch[1];
}
if (eregi("post([0-9]+).html$", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
if (eregi("post([0-9]+).html#post([0-9]+)$", $filename, $pmatch))
{
$filename = 'showthread.php';
$values['postid'] = $pmatch[1];
}
// added by dani for seo hack
Thanks for everyone's support with this hack over the last months. Keep in mind, as always, please don't redistribute my code in any way, shape, or form, on other websites, or in print. While I am offering use of this code for free, I put many hours into figuring out the algorithm, coding it, and publishing it, and it is still my intellectual property, and I would like the display of the code, itself, it to stay on DaniWeb only. I appreciate your cooperation. This also ensures that everyone can get support all in one place. :)
And as always, a link back is much appreciated but not necessary!;)