anthony parsons
04-27-2005, 05:59 PM
Daniweb (http://www.daniweb.com/techtalkforums/thread9379.html) supplies a great mod_rewrite for vbulletin, apart from it doesn't work in 3.0.7, so here is the correct version that does. If you have a previous version of vbulletin, I would suggest going to Daniweb (http://www.daniweb.com/techtalkforums/thread9379.html) and using the version posted their.
Step 1
Admin CP > Styles & Templates > Search in Templates > Find & Replace in Templates
Place the following code into the box "Search for Text"
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
Place the following code into the box "Replace with Text"
<a href="forum$forum[forumid].html">
Change check box "Test Replacement Only" from Yes to No.
Click "Find"
The following templates will be changed:
forumhome_forumbit_level1_nopost
forumhome_forumbit_level1_post
forumhome_forumbit_level2_nopost
forumhome_forumbit_level2_post
forumhome_subforumbit_nopost
forumhome_subforumbit_post
Step 2
Admin CP > Style Manager > Edit 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>
Step 3
Admin CP > Style Manager > Edit 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="thread$thread[threadid].html">
Find:
<a href="showthread.php?$session[sessionurl]t=$thread[threadid]&goto=lastpost$thread[highlight]">
Replace With:
<a href="lastpostinthread$thread[threadid].html">
Step 4
Create a .htaccess file with the following, and upload to the root forum folder, ie. where the forumdisplay.php and showthread.php files are.
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^thread([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?goto=newpost&t=$1 [L]
RewriteRule ^forum([0-9]+).html$ forumdisplay.php?f=$1 [L]
Step 5
Admin CP > Style Manager > Edit Templates > navbar
Find Twice:
<a href="$vboptions[forumhome].php?$session[sessionurl]" accesskey="1">
Replace Both Instances With:
<a href="./" accesskey="1">
Step 6
Edit forumdisplay.php & showthread.php in your forum root path.
forumdisplay.php, find:
// draw nav bar
showthread.php, find:
// draw navbar
A few lines below those above, in each file, you will find a loop that looks like:
foreach ($parentlist AS $forumID)
{
$forumTitle = .....
$navbits[.....
}
Replace Both Files With:
foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache["$forumID"]['title'];
$navbits["forum$forumID.html"] = $forumTitle; // edited by dani
}
Step 7
Admin CP > Style Manager > Edit Templates > showthread_similarthreadbit
Find:
<a href="showthread.php?$session[sessionurl]t=$simthread[threadid]" title="$simthread[preview]">$simthread[title]</a>
Replace With:
<a href="thread$simthread[threadid].html" title="$simthread[preview]">$simthread[title]</a>
That's It Folks!
Now just wait for all the search engines to spider your now friendly URL's.
A possible suggestion running static URL's, is to turn off your archive so you don't have two lots of static URL's being indexed. Don't **** search engines off.
Step 1
Admin CP > Styles & Templates > Search in Templates > Find & Replace in Templates
Place the following code into the box "Search for Text"
<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">
Place the following code into the box "Replace with Text"
<a href="forum$forum[forumid].html">
Change check box "Test Replacement Only" from Yes to No.
Click "Find"
The following templates will be changed:
forumhome_forumbit_level1_nopost
forumhome_forumbit_level1_post
forumhome_forumbit_level2_nopost
forumhome_forumbit_level2_post
forumhome_subforumbit_nopost
forumhome_subforumbit_post
Step 2
Admin CP > Style Manager > Edit 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>
Step 3
Admin CP > Style Manager > Edit 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="thread$thread[threadid].html">
Find:
<a href="showthread.php?$session[sessionurl]t=$thread[threadid]&goto=lastpost$thread[highlight]">
Replace With:
<a href="lastpostinthread$thread[threadid].html">
Step 4
Create a .htaccess file with the following, and upload to the root forum folder, ie. where the forumdisplay.php and showthread.php files are.
RewriteEngine on
Options +FollowSymLinks
RewriteRule ^thread([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?goto=newpost&t=$1 [L]
RewriteRule ^forum([0-9]+).html$ forumdisplay.php?f=$1 [L]
Step 5
Admin CP > Style Manager > Edit Templates > navbar
Find Twice:
<a href="$vboptions[forumhome].php?$session[sessionurl]" accesskey="1">
Replace Both Instances With:
<a href="./" accesskey="1">
Step 6
Edit forumdisplay.php & showthread.php in your forum root path.
forumdisplay.php, find:
// draw nav bar
showthread.php, find:
// draw navbar
A few lines below those above, in each file, you will find a loop that looks like:
foreach ($parentlist AS $forumID)
{
$forumTitle = .....
$navbits[.....
}
Replace Both Files With:
foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache["$forumID"]['title'];
$navbits["forum$forumID.html"] = $forumTitle; // edited by dani
}
Step 7
Admin CP > Style Manager > Edit Templates > showthread_similarthreadbit
Find:
<a href="showthread.php?$session[sessionurl]t=$simthread[threadid]" title="$simthread[preview]">$simthread[title]</a>
Replace With:
<a href="thread$simthread[threadid].html" title="$simthread[preview]">$simthread[title]</a>
That's It Folks!
Now just wait for all the search engines to spider your now friendly URL's.
A possible suggestion running static URL's, is to turn off your archive so you don't have two lots of static URL's being indexed. Don't **** search engines off.

