I found an error with the hack. If someone uses a : in their thread title it hoses the hack. The browser thinks is is a protocol that they are defining like http or ftp.

I'm sorry for not being active in this thread lately. I have been very busy with back to school stuff ;)

To go back and see if I could answer everyone's questions ...

Polo => I don't experience DaniWeb being too slow - it might have been that you accessed it during a very busy time of day, or your computer connection? If others notice it too, I will look into it

aussie, I'm not sure if this is the problem, but the same way you start off your rewritten urls with ^ you should end them with $ ... Unfortunately, I only have experience with phpBB2 and vBulletin3

Nkisberg, I'm actually a bit confused by your question :( Not sure what you're asking.

The .htaccess file will make the clean URLs redirect to the real ones when you load the clean URLs in your web browser. They will not change the way the forum behaves at all, or where links in the forum point to. You change the forum links by editing the vBulletin templates and the php files.

1EightT, what do you mean? I understand what you mean if there is a : in the forum URL, but the thread title is not affected by this hack?

This is what I am saying, or trying to say.

Visit www.nick0r.co.uk (my vb forum)

Click test on towards the right of the page, you'll see it leads to a 404.
I cannot see why it leads to a 404 as i've followed yours and teds instructions perfectly.

Next, click Main forum and then test and you'll see at the top:
Card Game Forums > Main Category > Main Forum

Click either main category or main forum and you'll be taken to a 404.

Both of the above problems I cannot work out how to fix, please advise.

Just to say i found a solution to the problem where you get and unknown url with thread(id).html , what i did was..

Open /includes/functions_online.php

Find:

switch($filename)

Above put:

if (eregi("thread", $filename)) {

	$filename = 'showthread.php';

}

This ensures that as long as the URL has the word thread in it, it trats it like a thread :cheesy:

Go to this forum on my site http://www.highaltitudeimports.com/f75-trade-zone.html

Click on any thread that has a : in the title like FS: Si Rims

As of page 3 there was a section added to the hack to have keyword rich url's for the threadbit. Works great, but what rewrite rule do we insert to convert the :'s into spaces or something else

1EightT

I think a ReWrite condition is required to strip out the : in thread titles.

From looking at the rewrite guide closest match to the practical examples listed would be:

<VirtualHost *:8008>
...
RewriteEngine On
# Either use the (plaintext) allow list from goodsites.txt
RewriteMap ProxyAllow txt:/usr/local/apache/conf/goodsites.txt
# Or, for faster access, convert it to a DBM database:
#RewriteMap ProxyAllow dbm:/usr/local/apache/conf/goodsites
# Match lowercased hostnames
RewriteMap lowercase int:tolower
# Here we go:

# 1) first lowercase the site name and strip off a :port suffix
RewriteCond ${lowercase:%{HTTP_HOST}} ^([^:]*).*$

# 2) next look it up in the map file.
# "%1" refers to the previous regex.
# If the result is "OK", proxy access is granted.
RewriteCond ${ProxyAllow:%1|DENY} !^OK$ [NC]
# 3) Disallow proxy requests if the site was _not_ tagged "OK":
RewriteRule ^proxy: - [F]
...
</VirtualHost>

Some modification is required to make it work though. Got stuck here.

ReWrite Guide

thanks cscgal, unfortunately with the $ it still behaved the same.

In my test template I had

<a href="./forumdisplay.php?fid=$forum[fid]">

replaced with

<a href="./$forum[fid].html">

and in htaccess have

RewriteRule ^forum([0-9]+).html$ forumdisplay.php?fid=$1 [L]


anyone see any issue with this as it isn't working!

Actually there is no need to mess around with mod_rewite to strip out the ":" in thread titles.
Just insert a colon in the code

/?!.$%£()~*@

This will strip out the : in thread urls.

forumdisplay.php

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

aussie: not really sure about your problem.. not sure which mod_rewrite version you are following but stick with one, cscgal or Ted S.

Zen


this is in relation to attempting rewrite on an xmb forum.

I wonder if Ted can write full instructions, e.g take the appropriate bits of cscgal's and put them into one set of instructions, I seem to think I've failed somewhere as i've got confused on which instructions to use.

As I require this to work, I've now posted this as a paid project at http://www.scriptlance.com/

If, interested, search for:

Mod_rewrite For Htaccess


Thank you.

Hi cscgal,

first, very nice tutorial - thank you so much.

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.

Can you please post the code you used to get the multiple pages for forum listings working?

Cheers,

Magicspark

Hello,thanks for all the great info in this thread.I seem to be having a problem with 404's on the index page just as previously stated in the thread by someone else.I havent quite been able to figure this out yet so if someone could possibly give me a hand id appreciate it :)

http://www.non-chalant.com/forum

If you need any extra info let me know,thanks.

Oh,another point,on some of the threadbit edits(particulary step 2)i had a problem with that edit just not existing in my template.As well on Step 7 there was only one instance of the code needing edited and it was stated to be 2.Also there was no accesskey 1 on the end of the only edit of Step 7 i found.Not positive if this has any bearing on my problem or not.I have edited some of my templates previously to make the forum more SEO friendly.Thanks again for the help

Ok,got the index 404 problem figured out myself.Now im having a 404 when i click on an actual thread(forumdisplay).I shall see if i can work this out myself but if anyone has any advice please clue me in as im going at this practicly blind :mrgreen:

awesome mod! works perfectly on my forum! Thanks csgal and Ted!

Alright,no luck so far in figuring out why im getting the 404's when trying to click on a thread.Ive checked some obvious things that would seem to effect it,still 404's.

If anyone could give me a point in the right direction and/or tell me what could be the root of this,im sure i could hack it out :D

Can you provide your URL please and also copy/paste your .htaccess here :)

Sure.My url is http://non-chalant.com/forum
And the .htaccess is,

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]

Thanks alot for the help ;)

hey Ted, I just noticed something else we have to edit if we follow your way of doing this. We would have to edit threadbit and postbit and do some changes.

example (postbit): http://www.thepcforum.com/forum/thread5.html
Click on Hardware or Processors (CPU) links in the navigation part.

example (threadbit): http://www.thepcforum.com/forum/f6-processors-(cpu).html
Click on Hardware link in navigation.

Unless I missed your directions on what to change?

hey Ted, I just noticed something else we have to edit if we follow your way of doing this. We would have to edit threadbit and postbit and do some changes.

example (postbit): http://www.thepcforum.com/forum/thread5.html
Click on Hardware or Processors (CPU) links in the navigation part.

example (threadbit): http://www.thepcforum.com/forum/f6-processors-(cpu).html
Click on Hardware link in navigation.

Unless I missed your directions on what to change?

Yeah,i think i edited mine if i remember right.

cscgal,any ideas yet about those 404's i got?I have a feeling its something simple,but i cant figure out for the life of me
:eek:

xStylezx, add the following line to your .htaccess file:

RewriteRule ^forum([0-9]+).html$ forumdisplay.php?f=$1 [L]

What you posted didnt clear it up,although its getting closer.I modified the entry you told me to add into this

RewriteRule ^thread([0-9]+).html$ forumdisplay.php?f=$1 [L]

Now the thread starts loading but i receive this vbulletin message

"No Forum specified. If you followed a valid link, please notify the webmaster"

:confused:

What you're trying to do is use a combination of my hack and of Ted's hack. The code that I just provided to you to add to your .htaccess should get the navbits working in the navigation part at the top of your page.

The modification you made is really wrong ;)

Im still a little lost as to what,if any changes i need to back out or add to get the threads loading. lmao

Usually never takes me this long to figure stuff out,even on my own.Sorry im hitting you with these onslaught of questions,im sure it can be tedious,but if you got more advice then im all ears.Thanks alot for your help thus far.

I have finally got my threads loading.haha I kept looking through this thread for others .htaccess info and tried substituting a few things and as soon as i added this

RewriteRule ^thread([0-9]+).html$ showthread.php?t=$1 [L]

Instead of

RewriteRule ^t([0-9]+)-(.*).html$ showthread.php?t=$1 [L]

Threads loaded right up.Im not exactly sure i understand why it wouldnt load with the latter,but at least i got it working,with alot of help from you. ;)

hey Ted, I just noticed something else we have to edit if we follow your way of doing this. We would have to edit threadbit and postbit and do some changes.

example (postbit): http://www.thepcforum.com/forum/thread5.html
Click on Hardware or Processors (CPU) links in the navigation part.

example (threadbit): http://www.thepcforum.com/forum/f6-processors-(cpu).html
Click on Hardware link in navigation.

Unless I missed your directions on what to change?

ok i'm sorry, this is part of the navbit, sorry, i'm still learning my way around vB

Step Eight

To finish editing the navbit breadcrumb, we must edit the .php files directly. To do this, we edit both the forumdisplay.php as well as the showthread.php files:

Do a search in forumdisplay.php for:

// draw nav bar

and do a search in showthread.php for

// draw navbar

A few lines below those lines, in both files, you will see a loop that looks somewhat like

foreach ($parentlist AS $forumID) {...}

Replace that loop with the following:

foreach ($parentlist AS $forumID)
{
$forumTitle = $forumcache["$forumID"]['title'];
$navbits["forum$forumID.html"] = $forumTitle; // edited by dani
}

Unfortunately, what we're doing here, is making the forums in the breadcrumb point to forum1.html and forum2.html. Due to reasons that are beyond the scope of this tutorial, it is impossible for us to use forum-name.html here. Basically, the way that vBulletin uses recursion to generate the breadcrumb, the forum ID numbers must be in the URL for it to work correctly. If you did use $navbits["forum$url.html"] instead of $navbits["forum$forumID.html"] then vBulletin would create all navbar breadcrumbs assuming that the forum you're currently browsing is a top-level forum. In other words, it is not a subforum of anyone. The way I figure it, at least forumXX.html is better than forumdisplay.php?f=XX.

i need the code for this but using Ted's method...

i need the code for this but using Ted's method...

Ted didnt post any code specific to the navbit did he?
Some of this navbit stuff i already had done myself as i did some previous hacks to remove sid from the url's and some other things to make my forum more google friendly.

On another unrelated note,as soon as i posted my url here for help,i know it wasnt minutes afterwards that inktomi bot assimilated all my info.Cant imagine it got very much though as threads werent loading at that point.Although at the bottom of the forum where i have latest post and replies the url's still have sid's in them as i havent changed that yet.Im curious as to whether it could download all the other threads from just that?As in following the next and previous topic links at the bottom of threads and picking them up even though i was still having the 404's using the .html links.Must have been downloading alot as there was like 90 something bots online at one time.250 something times my vb stat hack says inktomi visited within that short amount of time.Thats amazing :eek:

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.