Excellent! Thank you Dani :) Great Tutorial

I tried these 2 line modification to my archive file. The index page would not even load. Is there anything need to be added in the .htaccess file also?

I finally got that to work. The code for archive works fine. I just had to upload the "global.php" file again. I dont know what happened -- must have been an older version or something.

One more question Dani:

You said to use <h1> or <h2> tag for the titles. Can you elaborate a little. Do I just do the title of the page with h1 or h2? What did you mean by placing this code in the navbar:

<h1>$foruminfo[title]</h1>


Thanks for the answers to my earlier posts. Waiting for your answer before I make any changes.

It's an SEO technique to wrap important text or keywords that you wish to emphasize in H1 and H2 header tags. Therefore, in the SHOWTHREAD template, it's a good idea to put <h1>$foruminfo[title]</h1> and then use CSS to customize the look of the H1 tag. For more information, check out our Web Design forum :)

By default, the hack only fixes the generic forum and thread URLs in Who's Online. It doesn't handle multiple pages or when search queries are used, etc. For a completely mod_rewritten Who's Online, make the following changes to the includes/functions_online.php file. In each instance, replace the commented out line (the line with the //) with the non-commented line that appears below it. The lines will appear in the same order within the file as noted below.

Tks for your help. It's better but I still get this just for this kind of pages :

/threadnav32724-2-18.html
/threadnav33609-3-18.html

Another question : do you know where I can change properties of the navbar for this :

DaniWeb IT Community > Site Management and Internet Marketing > Web Hosting > Web Hosting Tutorials > vBulletin mod_rewrite for vB 3.0.7

I'd like to add a title attribute for forums links.

Tks.

Sorry for postining in the wrong place. I'll try here.

Hullo I'm new here and must say that I'm very impressed with this mod_rewwrite.

However, I have been looking at the most updated version and am a trying to incorporate this but am confussed by the following.

I have noted this:- 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.

So without further ado ...

$highlightwords = '&amp;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, '&', '&amp;') . '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", "&amp;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]", "&amp;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; 

I can see that I remove line 4. But from the layout of the code it seems that the replacement code exceeds more than 1 line. To me I think that I should replace with lines 5, 6, 7, 8, 10 and 11.

Sorry for not understanding fully.

Jezella

Take showthread.php for example:

Replace

$highlightwords = iif($goto, '&', '&amp;') . 'highlight=' . urlencode($_GET['highlight']);

with

$highlightwords = '-' . urlencode($_GET['highlight']);

Then replace

exec_header_redirect("showthread.php?$session[sessionurl_js]p=$getlastpost[postid]$highlightwords#post$getlastpost[postid]");

with

exec_header_redirect("threadedpost$getlastpost[postid]$highlightwords.html#post$getlastpost[postid]");

etc.

Got it real fab is this and seems to work a treat. Now I just have to set it up on the main forum and not the testing one.

I did misunderstand the following bits in your code and hope that what I have now done is correct.

$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>';
[/html]

showthread.php

[html]$highlightwords = iif($goto, '&', '&amp;') . 'highlight=' . urlencode($_GET['highlight']);
$highlightwords = '-' . urlencode($_GET['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>';
//[/html] deleted this

Next file to change

showthread.php

//[html] deleted this

$highlightwords = iif($goto, '&', '&amp;') . 'highlight=' . urlencode($_GET['highlight']);
$highlightwords = '-' . urlencode($_GET['highlight']);

Many thanks

Jezella

I know that another hack added to this most wonderful one posted here may not be right but I have found the following white space remover that helps pages load faster.

Here the link http://www.vbulletin.org/forum/showthread.php?t=69787

I have incorporated this also and set store CSS Styles Sheets as files to yes. With these 2 additional changes to my forum, page display is really fast.

The question is that as re_write is being used in this hack, could this additional white space remove cause a problem which I have not noticed. I have done a bit of testing and it appears not. However, I am far from an expert.

Comments would be appreciated.

I'm feeling good, I'm learning something.

Jezella

Great hack cscgal.
When you say "not for the faint hearted", you aren't kidding.
I recommend to anyone to edit a test board first if you can (I did mine on a exact copy child forum of my default forum first), and BACKUP!

Anyway, I did have a problem with the 'RewriteRule ^threadmode' section in the htaccess file I uploaded. It crashed the site. Don't know why. But I removed those sections for the 'threadmode' RewriteRule and it when back to normal. Also removed the template edits related to same. I don't mind, as I don't let visitors see the mode options anyway, and I removed the Hybrid option a while ago. I don't like the hybrid mode and 90% of my members said they never use it. Also didn't include the online part. I only allow it for members only.

Didn't do the archive in full either. I think part of showing the archives to bots is that they see the unformatted text of the posts (no graphics, etc). They seem to like that. But I did put in the 'View Full Version' links to point to the rewrite htmls'.

But for that, it works like a charm!
If you care to - << url snipped to comply with forum policy >>

I also have a hack named, 'Most Recent Posts', and I replaced the urls in there also. Works fine.

And, I also edited my vBAdvanced CMPS portal for the rewrite. cscgal, if you don't mind, I'll PM you the edits for you to check out. It works fine on my Forum, but you may want to look at my code edits first. << url snipped >>

John

Well here are my suggestions...

I would recommend making the instruction more clear... as they are right now I think people will find them confusing...

and fix them alittle bit, because right now there is some html tags that are appearing that shouldnt be there...

[quote]$forumcache["$forumid"]['title'] . '</u></b></a>';
[/html]

showthread.php

[html]$highlightwords = iif($goto, '&', '&amp;') . 'highlight=' .[/quote]

and also, it would be great if you could post the template modifications as many (like me) have modified their forums templates alot, and just replacing the new templates will revert all of their custom templates...

just my suggestions :) thank you for evertyig dani, this hack is really good :)

Amen Polo,

It is a bit confusing :confused: (the showthread.php edits should be separate). Obviously, the wrong tags got wrapped around that one part.

And anyone who has edited a lot of their existing templates (as I have) wouldn't want to upload a new xml and overwrite. I isolated and copied the individual template sections from the xml file and then compared them to my existing templates using a great utility called 'Beyond Compare'. It compares two files of a similar type, and shows you the differences between the two. You can then choose to copy line by line from one file to the other.

Also, it would be nice to put all those edits into a zip file for downloading rather than trying to copy directly from the post (pain in the neck).

Just my two cents added.

John

Hey Dani,
Thanks for the tutorial, great job. I am experiencing a problem though, which is causing a bit of trouble since my forum is pretty active. I did all the file edits, but the links to threads don't go anywhere. For example, on forum display, when I click a thread, it goes to http://*.com/lastpostinthread3050.html but nothing is there, so I just get a 404 error. I have uploaded the .htaccess file that you have provided as well in the directory vBulletin is in.

-Auvee B.

Well here are my suggestions...

I would recommend making the instruction more clear... as they are right now I think people will find them confusing...

and fix them alittle bit, because right now there is some html tags that are appearing that shouldnt be there...

and also, it would be great if you could post the template modifications as many (like me) have modified their forums templates alot, and just replacing the new templates will revert all of their custom templates...

just my suggestions :) thank you for evertyig dani, this hack is really good :)

I'm not a coder and this did cause me a small problem until I noticed the error.

[/html]

showthread.php

[html]

As I read it now the html end and start tags need to be removed. Plus the file is showthread.php.

It really would be great if the initial code was corrected, after all so much work has already gone into its.

Jezella

Has anyone worked out what alterations need to be made to vbAdvanced so that this great hack can be incorporated into that also? Which files need to be altered and what are the changes?

Jezella

So sorry about that. The first post has been updated accordingly.

Has anyone worked out what alterations need to be made to vbAdvanced so that this great hack can be incorporated into that also? Which files need to be altered and what are the changes?
Jezella

Yes, I have. But I'm not sure if I can post the edits here or over at vBadvanced, or both. You can see it on my site. Click the Home Page link in my Profile. Look for the 'Latest Forum Topics', left side, and the 'Forum Topics', center column.
John

Greetings Dani,

We just installed your vBulletin mod_rewrite for vB 3.0.7 hack and are quite excited about it.
It seems it's no longer possible to merge threads because VB doesn't recognize the html URLs.
Any idea on a workaround for this?

BTW, I'll add your site to my directory as a token of gratitude for your smart hack.

Best Regards....

Yes, I have. But I'm not sure if I can post the edits here or over at vBadvanced, or both. You can see it on my site. Click the Home Page link in my Profile. Look for the 'Latest Forum Topics', left side, and the 'Forum Topics', center column.
John

I must say that really is some forum, customization is wonderful, where did the Calendar|Clock come from. Why are you using cmps_index.php? instead od index.php. Please provide the code if possible for the re-write in vbAdvanced.

Jezella

Greetings Dani,

We just installed your vBulletin mod_rewrite for vB 3.0.7 hack and are quite excited about it.
It seems it's no longer possible to merge threads because VB doesn't recognize the html URLs.
Any idea on a workaround for this?

BTW, I'll add your site to my directory as a token of gratitude for your smart hack.

Best Regards....

Thank you for helping us out with a link. It's very appreciated.

When typing a URL into the merge thread textbox, simply enter t=XXX or showthread.php?t=XXX (the old non mod_rewritten version of the URLs)

Hey there fellas. I've got some updates to the hack I'd like to present you with. The following two make changes to the newthread.php and newreply.php files so that after new threads and new posts are written, you are taken back to the mod_rewritten versions of the URLs. Of course, search engines won't care about this either way, since spiders are unable to post. However, it's always a good idea to only allow members to see mod_rewritten versions whenever possible, just in case they should happen to land at an old style showthread.php?t= URL and copy and paste the URL in a post or on their website or such. It's just more complete that way. However, for the most of you, I'm sure you'll find this extraneous. But for those who would like it, here it is:

in newthread.php

$url = "showthread.php?$session[sessionurl]p=$newpost[postid]#post$newpost[postid]";
$url = "threadedpost$newpost[postid].html#post$newpost[postid]";
 
$url = "forumdisplay.php?$session[sessionurl]f=$foruminfo[forumid]";
$url = "forum$foruminfo[forumid].html";
 
$navbits["forumdisplay.php?$session[sessionurl]f=$forumID"] = $forumTitle;
$navbits["forum$forumID.html"] = $forumTitle;

in newreply.php

$url = "showthread.php?$session[sessionurl]t=$threadid";
$url = "thread$threadid.html";
 
	$url = "showthread.php?$session[sessionurl]p=$newpost[postid]&amp;posted=1#post$newpost[postid]";
	$url = "posted$newpost[postid].html#post$newpost[postid]";
 
	$url = "showthread.php?$session[sessionurl]p=$newpost[postid]#post$newpost[postid]";
	$url = "threadedpost$newpost[postid].html#post$newpost[postid]";
 
$url = "forumdisplay.php?$session[sessionurl]f=$foruminfo[forumid]";
$url = "forum$foruminfo[forumid].html";
 
$navbits["forumdisplay.php?$session[sessionurl]f=$forumID"] = $forumTitle;
$navbits["forum$forumID.html"] = $forumTitle;
 
$navbits["showthread.php?$session[sessionurl]p=$postid#post$postid"] = $threadinfo['title'];
$navbits["threadedpost$postid.html#post$postid"] = $threadinfo['title'];
 
$navbits["showthread.php?$session[sessionurl]t=$threadinfo[threadid]"] = $threadinfo['title'];
$navbits["thread$threadinfo[threadid].html"] = $threadinfo['title'];

There is something else that I have updated that you might find handy. On the forum display pages (the pages that list the threads) I have made changes to the column sorting so that they are fully mod_rewritten as well.

The following change was made to the forumdisplay.php file:

// prepare sort things for column header row:
// edited by Dani
// $sorturl = "forumdisplay.php?$session[sessionurl]f=$forumid&amp;daysprune=$daysprune";
$sorturl = "forum$forumid";
$sorturl2 = "-$vboptions[maxthreads]-$daysprune.html";

As you can see, replace the original commented out $sorturl = line with the following two $sorturl = and $sorturl2 = lines.

In addition, the FORUMDISPLAY template must be edited. Here is an updated version of that template. As mentioned earlier in this thread, a great program to use to compare file versions is Beyond Compare:

$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<meta name="description" content="$foruminfo[description]" />
<title>$foruminfo[title]</title>
$headinclude
</head>
<body>
$header
$navbar
<if condition="$show['forumslist']">
<!-- sub-forum list -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center" style="border-bottom-width:0px">
<tr>
<td class="tcat" width="100%">$vbphrase[subforums]<span class="normal">: $foruminfo[title]</span></td>
<if condition="$show['forumsearch']">
<td class="vbmenu_control" id="forumsearch.subforums"><a href="search.php?$session[sessionurl]f=$foruminfo[forumid]">$vbphrase[search_this_forum]</a> <script type="text/javascript"> vbmenu_register("forumsearch.subforums"); </script></td>
</if>
</tr>
</table>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<thead>
<tr align="center">
<td class="thead">&nbsp;</td>
<td class="thead" width="100%" align="$stylevar[left]">$vbphrase[forum]</td>
<td class="thead" width="175">$vbphrase[last_post]</td>
<td class="thead">$vbphrase[threads]</td>
<td class="thead">$vbphrase[posts]</td>
<if condition="$vboptions[showmoderatorcolumn]">
<td class="thead">$vbphrase[moderator]</td>
</if>
</tr>
</thead>
$forumbits
</table>
<br />
<!-- / sub-forum list -->
</if>
<if condition="$show['threadslist']">
<!-- threads list -->
<!-- controls above thread list -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-bottom:3px">
<tr valign="bottom">
<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>
<if condition="$pagenav"><td align="$stylevar[right]">$pagenav</td></if>
</tr>
</table>
<!-- / controls above thread list -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center" style="border-bottom-width:0px">
<tr>
<td class="tcat" width="100%">$vbphrase[threads_in_forum]<span class="normal">: $foruminfo[title]</span></td>
<td class="vbmenu_control" id="forumtools"><a href="#goto_forumtools">$vbphrase[forum_tools]</a> <script type="text/javascript"> vbmenu_register("forumtools"); </script></td>
<if condition="$show['forumsearch']">
<td class="vbmenu_control" id="forumsearch"><a href="#goto_forumsearch">$vbphrase[search_this_forum]</a> <script type="text/javascript"> vbmenu_register("forumsearch"); </script></td>
</if>
</tr>
</table>
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
$announcebits
<tr>
<if condition="$show['threadicons']">
<td class="thead" colspan="2">&nbsp;</td>
<else />
<td class="thead">&nbsp;</td>
</if> 
<td class="thead" width="100%">
<if condition="$show['threadratings']"><span style="float:$stylevar[right]"><a href="$sorturl-1-voteavg-desc$sorturl2">$vbphrase[rating]</a> $sortarrow[voteavg]</span></if>
<a href="$sorturl-1-title-asc$sorturl2">$vbphrase[thread]</a> $sortarrow[title] /
<a href="$sorturl-1-postusername-asc$sorturl2">$vbphrase[thread_starter]</a> $sortarrow[postusername]
</td>
<td class="thead" width="150" align="center" nowrap="nowrap"><span style="white-space:nowrap"><a href="$sorturl-1-lastpost-desc$sorturl2">$vbphrase[last_post]</a> $sortarrow[lastpost]</span></td>
<td class="thead" align="center" nowrap="nowrap"><span style="white-space:nowrap"><a href="$sorturl-1-replycount-desc$sorturl2">$vbphrase[replies]</a> $sortarrow[replycount]</span></td>
<td class="thead" align="center" nowrap="nowrap"><span style="white-space:nowrap"><a href="$sorturl-1-views-desc$sorturl2">$vbphrase[views]</a> $sortarrow[views]</span></td>
</tr>
<if condition="$show['threads']">
<!-- show threads -->
<if condition="$show['stickies']">
$threadbits_sticky
<!-- <tr><td class="thead" colspan="<if condition="$show['threadicons']">6<else />5</if>">&nbsp;</td></tr>-->
</if>
$threadbits 
<!-- end show threads -->
<else />
<!-- show no threads message -->
<tr>
<td class="alt1" colspan="$foruminfo[bottomcolspan]" align="center">
<div style="padding: 16px">
	<if condition="$show['noposts']"><strong>$vbphrase[no_posts_in_this_forum]</strong><else /><strong><phrase 1="$daysprune">$vbphrase[no_posts_last_x_days_forum]</phrase></strong><br />
	<span class="smallfont">$vbphrase[try_controls_below_for_older_posts]</span></if>
</div>
</td>
</tr>
<!-- end show no threads message -->
</if>
</table>
 
<!-- controls below thread list -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="margin-top:3px">
<tr valign="top">
<td class="smallfont"><if condition="$show['newthreadlink']"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]"><img src="$stylevar[imgdir_button]/newthread.gif" alt="$vbphrase[post_new_thread]" border="0" /></a><else />&nbsp;</if></td>
<if condition="$pagenav"><td align="$stylevar[right]">$pagenav</td></if>
</tr>
</table>
<!-- / controls below thread list -->
 
<br />
 
 
 
<!-- Active Users in this Forum (and sub-forums) and Moderators -->
<form action="forumdisplay.php" method="get">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="f" value="$forumid" />
<input type="hidden" name="page" value="$pagenumber" />
<input type="hidden" name="pp" value="$perpage" />
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">$vbphrase[display_options]</td>
<if condition="$show['activeusers']">
<td class="tcat">$vbphrase[currently_active_users]</td>
</if>
<if condition="$show['moderators']">
<td class="tcat">$vbphrase[moderators]</td>
</if>
</tr>
<tr>
<td class="thead"><phrase 1="$limitlower" 2="$limitupper" 3="$totalthreads">$vbphrase[showing_threads_x_to_y_of_z]</phrase></td>
<if condition="$show['activeusers']">
<td class="thead">$totalonline (<phrase 1="$numberregistered" 2="$numberguest">$vbphrase[x_members_y_guests]</phrase>)</td>
</if>
<if condition="$show['moderators']">
<td class="thead">$vbphrase[moderators]: $totalmods</td>
</if>
</tr>
<tr valign="top">
<td class="alt1">
 
<table cellpadding="0" cellspacing="1" border="0" width="auto">
<tr>
<td class="smallfont" style="padding-right:6px">$vbphrase[sorted_by]</td>
<td><select name="sort">
	<option value="title" $sort[title]>$vbphrase[thread_title]</option>
	<option value="lastpost" $sort[lastpost]>$vbphrase[last_post_time]</option>
	<option value="replycount" $sort[replycount]>$vbphrase[number_of_replies]</option>
	<option value="views" $sort[views]>$vbphrase[number_of_views]</option>
	<option value="postusername" $sort[postusername]>$vbphrase[thread_starter]</option>
	<if condition="$show['threadratings']"><option value="voteavg" $sort[voteavg]>$vbphrase[thread_rating]</option></if>
</select></td>
<td class="smallfont" style="padding-right:6px; padding-left:12px">$vbphrase[sort_order]</td>
<td><select name="order">
	<option value="asc" $order[asc]>$vbphrase[ascending]</option>
	<option value="desc" $order[desc]>$vbphrase[descending]</option>
</select></td>
</tr>
<tr>
<td class="smallfont" style="padding-right:6px">$vbphrase[from_the]</td>
<td><select name="daysprune">
	<option value="1" $daysprunesel[1]>$vbphrase[last_day]</option>
	<option value="2" $daysprunesel[2]>$vbphrase[last_2_days]</option>
	<option value="7" $daysprunesel[7]>$vbphrase[last_week]</option>
	<option value="10" $daysprunesel[10]>$vbphrase[last_10_days]</option>
	<option value="14" $daysprunesel[14]>$vbphrase[last_2_weeks]</option>
	<option value="30" $daysprunesel[30]>$vbphrase[last_month]</option>
	<option value="45" $daysprunesel[45]>$vbphrase[last_45_days]</option>
	<option value="60" $daysprunesel[60]>$vbphrase[last_2_months]</option>
	<option value="75" $daysprunesel[75]>$vbphrase[last_75_days]</option>
	<option value="100" $daysprunesel[100]>$vbphrase[last_100_days]</option>
	<option value="365" $daysprunesel[365]>$vbphrase[last_year]</option>
	<option value="-1" $daysprunesel[all]>$vbphrase[beginning]</option>
</select></td>
<td colspan="2" align="$stylevar[right]"><input type="submit" class="button" value="$vbphrase[show_threads]" /></td>
</tr>
</table>
 
</td>
<if condition="$show['activeusers']">
<td class="alt1"><div class="smallfont">$activeusers</div></td>
</if>
<if condition="$show['moderators']">
<td class="alt1"><div class="smallfont">$moderatorslist&nbsp;</div></td>
</if>
</tr>
</table>
</form>
<!-- End Active Users in this Forum (and sub-forums) and Moderators -->
<if condition="$show['popups']">
<br />
<!-- popup menu contents -->
 
<!-- forum tools menu -->
<div class="vbmenu_popup" id="forumtools_menu" style="display:none">
<form action="moderator.php" method="post" name="forumadminform">
<table cellpadding="4" cellspacing="1" border="0">
<tr><td class="thead">$vbphrase[forum_tools]<a name="goto_forumtools"></a></td></tr>
<if condition="$show['newthreadlink']"><tr><td class="vbmenu_option"><a href="newthread.php?$session[sessionurl]do=newthread&amp;f=$foruminfo[forumid]">$vbphrase[post_a_new_thread]</a></td></tr></if>
<tr><td class="vbmenu_option"><a href="forumdisplay.php?$session[sessionurl]do=markread&amp;f=$foruminfo[forumid]">$vbphrase[mark_this_forum_read]</a></td></tr>
<tr><td class="vbmenu_option"><a href="subscription.php?$session[sessionurl]do=addsubscription&amp;f=$foruminfo[forumid]">$vbphrase[subscribe_to_this_forum]</a></td></tr>
<tr><td class="vbmenu_option"><a href="forum$foruminfo[parentid].html">$vbphrase[view_parent_forum]</a></td></tr>
<if condition="$show['adminoptions']">
<tr>
<td class="thead">$vbphrase[admin_tools]<a name="goto_forumadmin"></a></td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite"> 
<div><label for="fa_mpo"><input type="radio" name="do" id="fa_mpo" value="modposts" checked="checked" />$vbphrase[view_posts_queue]</label></div>
<div><label for="fa_mat"><input type="radio" name="do" id="fa_mat" value="modattach" />$vbphrase[view_attachment_queue]</label></div>
<div><label for="fa_mov"><input type="radio" name="do" id="fa_mov" value="move" />$vbphrase[massmove_threads]</label></div>
<div><label for="fa_prn"><input type="radio" name="do" id="fa_prn" value="prune" />$vbphrase[massprune_threads]</label></div>
<if condition="$show['addmoderator']">
<div><label for="fa_amd"><input type="radio" name="do" id="fa_amd" value="addmoderator" />$vbphrase[add_moderator]</label></div>
</if> 
</td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite" align="center"> 
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="f" value="$forumid" />
<input type="submit" class="button" value="$vbphrase[perform_action]" />
</td>
</tr>
</if>
</table>
</form>
</div>
<!-- / forum tools menu -->
<!-- / popup menu contents -->
<else />
<!-- controls for non-popup browsers -->
 
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center" style="border-top-width:0px">
<tr>
<td class="thead">$vbphrase[forum_tools]<a name="goto_forumtools"></a></td>
<td class="thead">$vbphrase[search_this_forum]<a name="goto_forumsearch"></a></td>
</tr>
<tr valign="top">
<!-- forum tools -->
<td class="alt1">
<div class="smallfont">
<div><img class="inlineimg" src="$stylevar[imgdir_button]/subscribe.gif" alt="$vbphrase[mark_this_forum_read]" vspace="1" /> <a href="forumdisplay.php?$session[sessionurl]do=markread&amp;f=$foruminfo[forumid]">$vbphrase[mark_this_forum_read]</a></div>
<div><img class="inlineimg" src="$stylevar[imgdir_button]/subscribe.gif" alt="$vbphrase[subscription]" vspace="1" /> <a href="subscription.php?$session[sessionurl]do=addsubscription&amp;f=$foruminfo[forumid]">$vbphrase[subscribe_to_this_forum]</a></div>
<div><img class="inlineimg" src="$stylevar[imgdir_button]/subscribe.gif" alt="$vbphrase[view_parent_forum]" vspace="1" /> <a href="forum$foruminfo[parentid].html">$vbphrase[view_parent_forum]</a></div>
</div>
</td>
<!-- / forum tools -->
 
<!-- search this forum -->
<td class="alt1">
<form action="search.php" method="post">
<div class="smallfont">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="process" />
<input type="hidden" name="forumchoice" value="$forumid" />
<input type="hidden" name="childforums" value="1" />
<strong>$vbphrase[search_this_forum]</strong>:<br />
<input type="text" class="bginput" name="query" size="20" style="width:175px" />$gobutton<br />
<a href="search.php?$session[sessionurl]forumid=$forumid">$vbphrase[advanced_search]</a>
</div>
</form>
</td>
<!-- / search this forum --> 
</tr>
</table>
<br />
 
<!-- / controls for non-popup browsers -->
</if>
 
<!-- ############## END THREADS LIST ############## -->
</if>
<if condition="$show['popups'] AND $show['forumsearch']">
<!-- forum search menu -->
<div class="vbmenu_popup" id="forumsearch_menu" style="display:none">
<form action="search.php" method="post">
<table cellpadding="4" cellspacing="1" border="0">
<tr>
<td class="thead">$vbphrase[search_this_forum]<a name="goto_forumsearch"></a></td>
</tr>
<tr>
<td class="vbmenu_option" title="nohilite">
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="do" value="process" />
<input type="hidden" name="forumchoice" value="$forumid" />
<input type="hidden" name="childforums" value="1" />
<input type="text" class="bginput" name="query" size="20" />$gobutton<br />
</td>
</tr>
<tr>
<td class="vbmenu_option"><a href="search.php?$session[sessionurl]forumid=$forumid">$vbphrase[advanced_search]</a></td>
</tr>
</table>
</form>
</div>
<!-- / forum search menu -->
</if>
<!-- icon key -->
<if condition="$show['threadslist']">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td><img src="$stylevar[imgdir_statusicon]/thread_new.gif" alt="$vbphrase[new_posts]" border="0" /></td>
<td class="smallfont">$vbphrase[new_posts]</td>
<if condition="$vboptions['usehotthreads']">
<td><img src="$stylevar[imgdir_statusicon]/thread_hot_new.gif" alt="<phrase 1="$vboptions[hotnumberposts]" 2="$vboptions[hotnumberviews]">$vbphrase[more_than_x_replies_or_y_views]</phrase>" border="0" /></td>
<td class="smallfont">$vbphrase[hot_thread_with_new_posts]</td>
<else />
<td colspan="2">&nbsp;</td>
</if>
</tr>
<tr>
<td><img src="$stylevar[imgdir_statusicon]/thread.gif" alt="$vbphrase[no_new_posts]" border="0" /></td>
<td class="smallfont">$vbphrase[no_new_posts]</td>
<if condition="$vboptions['usehotthreads']">
<td><img src="$stylevar[imgdir_statusicon]/thread_hot.gif" alt="<phrase 1="$vboptions[hotnumberposts]" 2="$vboptions[hotnumberviews]">$vbphrase[more_than_x_replies_or_y_views]</phrase>" border="0" /></td>
<td class="smallfont">$vbphrase[hot_thread_with_no_new_posts]</td>
<else />
<td colspan="2">&nbsp;</td>
</if>
</tr>
<tr>
<td><img src="$stylevar[imgdir_statusicon]/thread_lock.gif" alt="$vbphrase[closed_thread]" border="0" /></td>
<td class="smallfont">$vbphrase[thread_is_closed]</td>
<if condition="$show['dotthreads']">
<td><img src="$stylevar[imgdir_statusicon]/thread_dot.gif" alt="$vbphrase[thread_contains_a_message_written_by_you]" border="0" /></td>
<td class="smallfont">$vbphrase[you_have_posted_in_this_thread]</td>
<else />
<td colspan="2">&nbsp;</td>
</if>
</tr>
</table>
<else />
<table cellpadding="0" cellspacing="2" border="0" width="100%">
<tr valign="bottom">
<td>
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td><img src="$stylevar[imgdir_statusicon]/forum_new.gif" alt="$vbphrase[contains_new_posts]" border="0" /></td>
<td class="smallfont">&nbsp; $vbphrase[forum_contains_new_posts]</td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_statusicon]/forum_old.gif" alt="$vbphrase[contains_no_new_posts]" border="0" /></td>
<td class="smallfont">&nbsp; $vbphrase[forum_contains_no_new_posts]</td>
</tr>
<tr>
<td><img src="$stylevar[imgdir_statusicon]/forum_old_lock.gif" alt="$vbphrase[a_closed_forum]" border="0" /></td>
<td class="smallfont">&nbsp; $vbphrase[forum_is_closed_for_posting]</td>
</tr>
</table>
</td>
</tr>
</table>
</if>
<!-- / icon key -->
<!-- forum rules & forum jump -->
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
<tr valign="top">
<td width="100%">
<div class="smallfont">&nbsp;</div>
<if condition="$show['threadslist']">$forumrules</if>
</td>
<td>
$forumjump
<if condition="!$show['popups'] AND $show['adminoptions']">
<br />
<form action="moderator.php" method="get"> 
<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="f" value="$forumid" />
<div class="smallfont"><strong>$vbphrase[admin_tools]</strong>:</div>
<select name="do" onchange="this.form.submit();">
	<optgroup label="$vbphrase[admin_tools]">
	 <option value="modposts" selected="selected">$vbphrase[view_posts_queue]</option>
	 <option value="modattach">$vbphrase[view_attachment_queue]</option>
	 <option value="move">$vbphrase[mass_move]</option>
	 <option value="prune">$vbphrase[mass_prune]</option>
	 <if condition="$show['addmoderator']">
	 <option value="addmoderator">$vbphrase[add_moderator]</option>
	 </if>
	</optgroup>
</select>$gobutton 
</form>
</if>
</td>
</tr>
</table>
<!-- / forum rules & forum jump -->
$footer
</body>
</html>

The forumdisplay_sortarrow template must also be updated:

<if condition="THIS_SCRIPT==forumdisplay">
<a href="$sorturl-$pagenumber-$sortfield-$oppositesort-$perpage-$daysprune.html"><img class="inlineimg" src="$stylevar[imgdir_button]/sort$oppositesort.gif" alt="$vbphrase[reverse_sort_order]" border="0" /></a>
<else />
<a href="$sorturl&amp;order=$oppositesort&amp;sort=$sortfield&amp;pp=$perpage&amp;page=$pagenumber"><img class="inlineimg" src="$stylevar[imgdir_button]/sort$oppositesort.gif" alt="$vbphrase[reverse_sort_order]" border="0" /></a>
</if>

Here is an updated version of the .htaccess file. This updated version is required for all of the above hacks.

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^forum([0-9]+).html$		forumdisplay.php?f=$1		 [L]
RewriteRule ^forum([0-9]+)-([0-9]+)-(.*)-(.*)-([0-9]+)-(.*).html$ forumdisplay.php?f=$1&page=$2&sort=$3&order=$4&pp=$5&daysprune=$6 [L]
RewriteRule ^announcement([0-9]+).html$	 announcement.php?f=$1	 [L]
RewriteRule ^announcement([0-9]+)-([0-9]+).html$	announcement.php?f=$1&announcementid=$2 [L]
RewriteRule ^printthread([0-9]+).html$	 printthread.php?t=$1	 [L]
RewriteRule ^sendthread([0-9]+).html$	 sendmessage.php?do=sendtofriend&t=$1 [L]
RewriteRule ^referthread([0-9]+)-([0-9]+).html$	showthread.php?t=$1&referrerid=$2	[L]
RewriteRule ^thread([0-9]+).html$	 showthread.php?t=$1	 [L]
RewriteRule ^thread([0-9]+)-(.*).html$	 showthread.php?t=$1&highlight=$2	[L]
RewriteRule ^nextnewesttothread([0-9]+).html$	showthread.php?t=$1&goto=nextnewest	[L]
RewriteRule ^nextoldesttothread([0-9]+).html$	showthread.php?t=$1&goto=nextoldest	[L]
RewriteRule ^threadnav([0-9]+)-([0-9]+).html$	showthread.php?t=$1&page=$2&pp=$3	[L]
RewriteRule ^threadnav([0-9]+)-([0-9]+)-([0-9]+).html$ showthread.php?t=$1&page=$2&pp=$3	[L]
RewriteRule ^threadnav([0-9]+)-([0-9]+)-([0-9]+)-(.*).html$ showthread.php?t=$1&page=$2&pp=$3&highlight=$4 [L]
RewriteRule ^threadmode([0-9]+)-linear.html$ showthread.php?t=$1&mode=linear	[L]
RewriteRule ^threadmode([0-9]+)-hybrid.html$ showthread.php?t=$1&mode=hybrid	[L]
RewriteRule ^threadmode([0-9]+)-threaded.html$ showthread.php?t=$1&mode=threaded	[L]
RewriteRule ^threadmode([0-9]+)-linear-(.*).html$ showthread.php?t=$1&highlight=$2&mode=linear [L]
RewriteRule ^threadmode([0-9]+)-hybrid-(.*).html$ showthread.php?t=$1&highlight=$2&mode=hybrid [L]
RewriteRule ^threadmode([0-9]+)-threaded-(.*).html$ showthread.php?t=$1&highlight=$2&mode=threaded [L]
RewriteRule ^post([0-9]+).html$	 showthread.php?p=$1 
RewriteRule ^post([0-9]+)-([0-9]+).html$	showpost.php?p=$1&postcount=$2	[L]
RewriteRule ^post([0-9]+)-([0-9]+)-([0-9]+)-(.*).html$ showthread.php?p=$1&page=$2&pp=$3&highlight=$4 [L]
RewriteRule ^posted([0-9]+).html$	 showthread.php?p=$1&posted=1	 [L]
RewriteRule ^threadedpost([0-9]+).html$	showthread.php?p=$1	 [L] 
RewriteRule ^threadedpost([0-9]+)-(.*).html$ showthread.php?p=$1&highlight=$2	[L]
RewriteRule ^postmode([0-9]+)-linear-(.*).html$ showthread.php?p=$1&highlight=$2&mode=linear [L]
RewriteRule ^postmode([0-9]+)-hybrid-(.*).html$ showthread.php?p=$1&highlight=$2&mode=hybrid [L]
RewriteRule ^postmode([0-9]+)-threaded-(.*).html$ showthread.php?p=$1&highlight=$2&mode=threaded [L]
RewriteRule ^postmode([0-9]+)-(.*).html$ showthread.php?p=$1&mode=$2	[L]
RewriteRule ^lastpostinthread([0-9]+).html$ showthread.php?goto=lastpost&t=$1 [L]
RewriteRule ^lastpostinthread([0-9]+)-(.*).html$ showthread.php?goto=lastpost&t=$1&highlight=$2 [L]
RewriteRule ^newpostinthread([0-9]+).html$ showthread.php?goto=newpost&t=$1 [L]

Enjoy! As previously mentioned, what is demonstrated here are two added features that mod_rewrite other parts of the forum that weren't mentioned in the original hack. They aren't bug fixes and they aren't required.

I thak you for your help again.

Thank you for helping us out with a link. It's very appreciated.

When typing a URL into the merge thread textbox, simply enter t=XXX or showthread.php?t=XXX (the old non mod_rewritten version of the URLs)

Hi Dani ,
I have a question. Is it possible to get mod_rewrite working just using with conditionals ? I only want mod_rewrite applied with some conditionals so just guests will see the urls in html format.
Also i have vBadvanced CMPS and Gallery installed in my board is it possible to apply mod_rewrite for these modifications ?

hi

in your vbulletin-seo.xml
you have that "postbit_legacy" forgotten

mfg

Hi Dani,

It seems that there is a bug within the searching and highlight words. When I search for TCP/IP the search results are fine, however the links from mod_rewrite end up like:

thread123-TCP/IP.html

Which would be fine but upon clicking the thread the following occurs:

thread57-TCP%2FIP.html

Which is standard link functionality within browsers. However we're in need of "/" staying as "/".

Which cannot be viewed. Is there anyway around this?

Thanks.

Thanks for pointing out this bug. Unfortunately there is no way around this that I know of right now. The fact that the / converts to its URL equivalent (the % version) is not a problem at all. That's the way it's supposed to work. In fact, it works fine with all other symbols. The problem with the / is that since it appears in the URL before the file extension as a .html URL, it is portrayed as a new directory. For example, for the file thread123-TCP/IP.html the web browser thinks that IP.html is a file within the thread123-TCP directory. It's almost not worth mod_rewriting the search results since no spiders will ever see them.

Here is a temporary fix (aka workaround) to the above problem. It basically strips out the / character from search queries.

In includes/functions_search.php

Below

$query = trim(preg_replace($qu_find, $qu_replace, " $query "));

Add

$query = str_replace("/", " ", $query);

is there a way to get this working with the Geek Articles system so all my article's URL will look nice with the title in them?

Here is a temporary fix (aka workaround) to the above problem. It basically strips out the / character from search queries.

In includes/functions_search.php

Below

$query = trim(preg_replace($qu_find, $qu_replace, " $query "));

Add

$query = str_replace("/", " ", $query);

Thank you Dani, you're a darlin.

No problem. And for those who would like to know if this hack is compatible with vBAdvanced, vBIndex, or any other vBulletin hack, I really don't know - I have no experience with any of them.

What I will say, however, is that I will try my best to make this hack compliant with the new hooks 'n' plugs feature in vB 3.5 which is due out to be released soon. In the new version, supposedly hacks will not require editing of PHP code, so we'll see how that works when it gets here!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.