You're very welcome ToOnZ! I hope you got it all straightened out. Darmak, what you're asking seems that it can be accomplished by editing the includes/functions_online.php file. There is actually an existing vB.org hack that might be helpful - please let us know if it worked for you:

http://www.vbulletin.org/forum/showthread.php?t=66569

You're very welcome ToOnZ! I hope you got it all straightened out. Darmak, what you're asking seems that it can be accomplished by editing the includes/functions_online.php file. There is actually an existing vB.org hack that might be helpful - please let us know if it worked for you:

http://www.vbulletin.org/forum/showthread.php?t=66569

Thanks but this hack is for .php scripts and not works whit this mod :/

Any other idea?

Are you sure? I was under the impression it will work for all files - php and html. In any case, the file that you would need to edit is the includes/functions_online.php file. When I have more time, I'll investigate it further.

I've just tried to have a proper go of this on my religion forums - I did try very hard to follow the instructions as entirely and *only* described in the original post - - - but I have a problem I'm afraid I don't understand, and input would be much much appreciated.

The problem is that every single link leads to a 404. I have an index page with no working links.

However, a couple of things don't look as planned and this may help diagnose the problem:

I tried to follow CSGAL's method of using .htaccess to rename all boards on a forum.

Yet whether I include the rewrites for my individual board names - or not - in the .htaccess file, all of my board names are rewritten anyway.

So whether I include:

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] 
   
   [b]RewriteRule ^belief-spirituality.html$ forumdisplay.php?f=12 [L][/b]

or not, my boards still have their names rewritten - for example, the above forum is rewritten as:

/community/belief-and-spirituality.html


Another odd thing is that my sub-forums are all showing with the link:

/community/.html

And that's with - or without - the .htaccess file editing.

None of the "newpostinthread2333.html" etc links work either - absolutely every forum link goes to a 404.

Any ideas whatsoever would be greatly appreciated. I'll keep the forum closed down for the time being until I can get this figured out - at least for today.

Help. Please?

:eek:

Board names are rewritten due to Step 1, editing the includes/functions_forumlist.php file - nothing to do with the editing of the .htaccess file.
Your sub-forums showing a bad link looks like you made a typo in the forumhome_subforumbit_nopost or forumhome_subforumbit_post templates. Just revert those two templates and try again - it looks like you have an added '/' symbol somewhere.
As far as why newpostinthread links don't work - that doesn't make sense. By looking at your .htaccess file they should. But let's take care of one problem at a time. And when everything else is fixed, then we'll look at this problem.

Thanks for the suggestions - much appreciated.

I just repeated everything again, reverting all templates, then re-editing them carefully, trying not to make typos - but nothing has changed.

Is it possible that there's something about Apache that is unusually configured on the server my forums are running from? I know on another vBulletin I have the static archive feature does not work because PHP is running as CGI. Is it possible that something similar is happening here?

Here's what to do. Create an .htaccess file and put everything from Step 5 only into it. Upload it to your forum's root directory. Then, manually type into your browser: www.yourdomain.com/forum/forum1.html or whatever your directory structure just happens to me. Then let me know what happened.

Ah-ha-ha! Success!

The key was the .htaccess file in the forum root folder! (As opposed to site root folder, if forum not at the root.)

The only possible additional issue is that the forum titles absolutely had to be the forum URLs - so a board named "keyword1 and keyword2" could not be in the .htaccess file as "keyword1-keyword2" - had to be "keyword1-and-keyword2". I wasn't expecting that. But was easily corrected for via .htaccess.

Dani, you are so a star. :)

Ten thousand blessings on you. :)

I'm really glad you got it working Brian :) Very cool! I just went back and double-checked my original tutorial thinking maybe I left out about how the .htaccess has to go in your forum directory, but nope, it said that all along ;)

Also, the file includes/functions_forumlist.php creates forum URLs by taking the forum title, converting all letters to lowercase, replacing all slash characters with the dash character, and replacing all spaces with the dash character. So a forum called "Me and You" will be translated to "me-and-you" given those rules.

With a bit of tweaking to Step One of the tutorial, you can remove the word "and" from your rewritten URLs ... or basically remove / tweak / edit any combination of letters to be translated into how you want. I could even tweak it so that a forum called "Dani and vBulletin" could be translated to the URL "dani-and-vB" by replacing all instances of vBulletin with vB ... or translated to "dani-vBulletin" by replacing all instances of " and" with the empty/null string. As you can see, this is the same logic that is used to replace a space " " character with a "-" dash character.

Thanks for the tips - it's always just the daft little things that floor me. Apologies if I made you look too hard. :)

To help make this hack easier to understand I have combined my changes along with the changes from KeithMcL into one post. Please be aware, you will sitll need to do about 90% of what the original post perscribes, this update is only meant to convert forum and thread urls into keyword rich urls.

1) Edit the functions_forumlist.php file

Search for:

// do light bulb 
$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);

and below that add

// added by dani 
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title']))); 
// added by dani

2) Edit the forumdisplay.php

Search for:

$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);

and below that add

// added by keith 
$thread['url'] = strtolower(str_replace(" ", "-", $thread['threadtitle'])); 
$thread['url'] = ereg_replace("[/?!.$%£()~*@]+", "", $thread['url']); 
// added by keith

3) Use the following code in your .htaccess file:

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?goto=newpost&t=$1 [L]
RewriteRule ^f([0-9]+)-(.*).html$ forumdisplay.php?forumid=$1 [L]

You may need to use [R] flags if you have the quick style chooser enabled.

4) Edit the threadbit template

Search for:

<a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]">and replace with
<a href="t$thread[threadid]-$thread[url].html"">

5)
Within the FORUMHOME template group:

forumhome_forumbit_level1_nopost

<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">

forumhome_forumbit_level1_post

<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">

forumhome_forumbit_level2_nopost

<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">

forumhome_forumbit_level2_post

<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">

forumhome_subforumbit_nopost

<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">

forumhome_subforumbit_post

<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">

All need to be replaced with the following:

<a href="f$forum[forumid]-$forum[url].html">

Apply these changes in conjunction with the other changes listed here and you will have one killer SEO hack!

I just installed it :) Its great, two probel m ihave are the online.php probelm and on index.php if you directly click the latest thread then it goes to the old .php file, however i shall be able to fix this :cheesy:

Fantastic mod! :)

Ok i got it all good now, im going to start adding this to more pages such as who's online and profile pages, if i discover anythng i shall post it up :)

If you are using the quick style chooser as I am you will want to change the modrewrite flags [R] and [L] to [QSA,L] which will append the query strings as needed.

I have got myself in a bit of a pickle, im trying to get it to show properly on online.php when somebody visits thread$threadid.html and i tried this code:

case 'thread.html':
			if (isset($values['goto']) AND $values['goto'] == 'lastpost')
			{
				$userinfo['activity'] = 'forumdisplay';
			}
			else
			{
				$userinfo['activity'] = 'showthread';
			}
		break;

Of course that doesnt work since its thread ID .html , how should i got about getting this to work?

This is probably one of the best hacks I have ever applied to my board. I have now done pretty much everything in this thread and it works perfectly. (hope none of my competators ever find this thread ;) )

I do have a couple questions however. First is the navigation for the threads that span multiple pages. Actually you know what? I'm going to go look at those navigation templates. It is probably a simple change that would fix that.

On to my next two questions. I know this site used vbadvanced cmps which is what I use on a couple sites. What modifications were necessary to get the friendly url's in the revent topics box on the right column of the forums?

Also I noticed this site uses the link system from vbulletin.org for its weblinks. Would you also share the modifications you made there?

Thanks again everyone who has shared in this hack :)

The page navigation would take a new rewrite rule it looks like. I'll mess with it and see if I can come up with one that works.

To answer your question about the navigation of the threads and forums that span multiple pages ... this can be done, but it's a tad complicated. Here on DaniWeb, I've done it to the forums but not to the threads. It involves editing the pagenav templates IN ADDITION to the forumdisplay.php, showthread.php, memberlist.php, etc. files - all of the pages which use pagination (i.e. spread across multiple pages) Multiple htaccess rules must be added as well.

On DaniWeb, I've only bothered to add rewritten multiple pages to the forum listings and not to the actual threads. This is because it's important for google to spider the multiple forum pages to find links to all of the threads on DaniWeb, but it's not important for people to find the middle of threads through google - I'd rather them get the full benefit and only find the first page - after all, that's the one with the google ad ;) and that's also the one that makes the most sense to initially read.

To answer your second question, this site has never used vBAdvanced CMPS. We used to use the very original version of vBAdvanced. Now, we use an index page that I developed myself.

The listing of recent threads on the forum index page are actually just JavaScript that reads from the external.php?type=js file built into vBulletin. For the code that was used to get this working, check out: - If you're going to use this feature on your site, be sure to enable JS syndication from the vB admin panel.

The links page that DaniWeb uses is a hacked version of the links script available on vB.org, so you're right about that ;) Nearly every template was rewritten. The only change made to the php code was to alter the script to periodically check to ensure that a backlink exists on all URLs listed in the directory. I may consider releasing this in the future - not sure yet ;)

Thank you for the quick reply. I see your point about teh multiple pages and agree with you there. I hadn't really thought about it before.

I hadn't thought about using the js syndication for the side bar. I was just using a module for mine from vbadvanced which is probably whi I thought you were doing the same.

Let me know if you do decide to release your modified link page. I'd be interested :).

When somebody visits thread(threadid).html it shows up as an unknown location on online.php, how can i fx this? I cant add an entry as i am unsure how to get it to work as the id is acctually part of the filename...

I see you asked this question a few posts up already. Please don't double post - unfortunately, I haven't had time to look into the online.php as it isn't a priority for me.

after upload .htaccess, i get 500 Internal Server Error :o

You either did something wrong witha code replacement, or you have the wrong lines in your .htaccess :).


On a side note, has anyone else had problems with the links on the new posts screen pointing to the wrong forum. not the posts themselves that come up in the search, but the links to the forum they were posted in. On 3 of my sites they all point to a single forum rather than the correct forum.

Hi, sorry, my english isn`t the best ;)

this ist my .htaccess

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]
RewriteRule ^aktuelles.html$ forumdisplay.php?f=1 [L]
RewriteRule ^ankuendigungen.html$ forumdisplay.php?f=2 [L]
RewriteRule ^dsl.html$ forumdisplay.php?f=3 [L]
.
.
.

yeah, it works:

RewriteEngine on
#Options +FollowSymLinks
.
.
.

...but I have another problem.

my sub-forums look like this:

/forum/.html

When somebody visits thread(threadid).html it shows up as an unknown location on online.php, how can i fx this? I cant add an entry as i am unsure how to get it to work as the id is acctually part of the filename...

I'm having the same problem... any idea at least on where to look to try to solve this?

something else... daniweb.com is really slow, does it have to do with anything and this modification of friendly urls?

Hi, 1st things 1st!

My 1st post here - hello!

2nd, apologies to 'nintendo' at another forum where I posted this same query - this forum seems more active so perhaps more chance of an answer!


I use xmb forum and am looking to do rewrites on forum displays and thread views. I have this in .htaccess :

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^forums/([0-9]+)/([0-9]+) forumdisplay.php?fid=$1&page=$2
RewriteRule ^forums/([0-9]+) forumdisplay.php?fid=$1
RewriteRule ^threads/([0-9]+)/([0-9]+) viewthread.php?tid=$1&page=$2
RewriteRule ^threads/([0-9]+) viewthread.php?tid=$1

with a test template change and I assumed that only forum areas with forumdisplay.php.... and viewthread.php... would be rewritten as /forums and /threads however it appears this affects all links as for example, when I view a forum area and then hover my mouse over a logout link, the url shown is http://www.mysite.com/forum/forums/misc.php?action=logout (and doesn't work) whereas without the .htaccess file it is http://www.mysite.com/forum/misc.php?action=logout


Is this "normal" behaviour and how do you overcome it?!

Hmmm could someone put Ted's guide and dani's guide together to make one proper guide, I got lost somewhere and it all seems to work except for:

If you click the last thread name on the mainpage e.g "test" towards the right, you'll see the error, i'm not sure where I went wrong, I tracked my steps.

Also if you go to view a thread a normal way and then use the
Card Game Forums > Main Category > Main Forum
navigation, it gives you 404's and I can see why. This is someone after I added ted's updates.

THe url is www.nick0r.co.uk to check it out, help is appreciated.

I guess what I'm trying to ask is should only the 'links' defined in the rewrite be affected, or after the rewritten page is loaded, do any other (relative) links on that page not defined in the htaccess file then pickup and become part of the rewritten page and use the new characteristics such as the new folder address?

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.