I'm getting the same issue, but as I've been following not just the sage advice of cscgal, but also the other gurus in this thread, the links still work: however my links show up as

http://www.mobileforces.org/forums/f13-.html

as my tempalte is of the following structure

<img class="inlineimg" src="$stylevar[imgdir_statusicon]/subforum_$forum[statusicon].gif" alt="" /> <a href="[b]f$forum[forumid]-[/b]$forum[url].html">$forum[title]</a>

and my .htaccess line in reference is as follows:

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

I don't know why this is happening, as the code definitely seems to be processing properly in all other cases.

I hope there is a solution, but for this structure of link, the links still work, they are just not showing the formatted title in the link name...

Can someone help me solve a few parse errors. I was fairlr careful to make sure I did everything correct.

When I click on a thread it works fine.
When I click on a forum it works fine.

When I click on "Main Category" I get the following error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/myphotos/public_html/forum/includes/functions_forumlist.php(441) : eval()'d code on line 11

And when I goto my forums homepage I get the following error:
Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/myphotos/public_html/forum/includes/functions_forumlist.php(441) : eval()'d code on line 5


I edited all files in notepad not dreamweaver.

If anyone could help me that would be great.

Can someone please help me with regards to this? My forum is useless as I get these errors and it needs to be launched in under 1 week.

Can someone please help me with regards to this? My forum is useless as I get these errors and it needs to be launched in under 1 week.

To me it looks like you need to edit your tempaltes again - try reverting your templates and re-applying the edits (try changing $forum for $forum in all cases)

Thanks Dani - just applied everything on a new site and everything working fine. :)

However, something you may like to look at is that with user profiles, the record of posts in "find all posts by user" comes up as dynamic links, not static HTML ones. You've addressed that in your original mod_rewrite here, but it doesn't seem addressed in your latest mod - just checked out the SEO-guy forums and it's doing it there.

The concern there is simply that with static and dynamic pages listed, there's duplicated content, and I'm not sure how the search engines will deal with that issue.

Anyway...thanks you for a fine mod anyway. :)

Hey there Brian :) The "find all posts by user" is based on vBulletin's search feature. Therefore, it is necessary to edit the templates that vBulletin uses when you perform searches. There are two templaets involved here, as searches can display results as threads or can display results as posts.

When a search displays results as a thread, the threadbit template is used. So that is already taken care of. However, when a search displays results as a post, the template to be concerned with is search_results_postbit

This template has one occurrence of showthread.php? that will need to be updated and one occurrence of forumdisplay.php? that will need to be updated, as well.

RE: Who's Online Full Solution

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...

OK - I followed your later post about this issue, and took it to the nth degree:

There are a couple of things to do here:

  • in includes/functions_online.php, add a new function:
    function mod_rewrite_title($title)
    {
    	$rewritten = strtolower(str_replace(" ", "-",str_replace("/", "-", $title)));
    	return ereg_replace("[/?!.:$%£()~*@]+", "", $rewritten);
    }
  • Then, find:
    convert_short_varnames($values);
    
    	$userinfo['values'] = $values;
  • Add below:
    if (eregi("t([0-9]+)-(.*).html$", $filename, $tmatch)) 
    	{
    		$filename = 'showthread.php';
    		$values['threadid'] = $tmatch[1];
    	}
    
    	if (eregi("f([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];
    	}
  • NOTE: in this above addition, you MUST alter the thread, forum and post rewrite statements to match those in your htaccess!
  • Now, search for every instance of
    $userinfo['where']

    which refers to the three $filename instances above and alter the <a href="... statement to match the rewritten display of your URLs...
    examples

    $userinfo['where'] = "<a href=\"f$forumid-" . mod_rewrite_title($forumtitle) . ".html\">$forumtitle</a>";
    
    $userinfo['where'] = "<a href=\"t$forumid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";
    
    $userinfo['where'] = "<a href=\"post$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";

It's really complex here, but you will see what I mean :)

Too complicated for me, Natch! :) That's why I never bothered hehe.

Heh: I know what you mean, but as my board is just as much an experiment of mine as a active forum, I can afford to screw up once in a while ;)

This last bit in my post above can be broken up into two parts:

One part makes the Who's online refer to the right link name (adding the code just below

convert_short_varnames($values);

$userinfo['values'] = $values;

)

The rest of the mod is what's required to force the links to be links to the rewritten URI's not the showthread.php/forumdisplay.php links, etc

Hello,


i have a prob with the sub-forums it looks lite "Forumname".html and the link dont work.

Have somebody a idea!


CU

Mav

Hello,


i have a prob with the sub-forums it looks lite "Forumname".html and the link dont work.

Have somebody a idea!


CU

Mav

Hello at all,

now i got it, so can somebody rewrite this hack, so can everybody do this hack on a forum.

A new Manual are be good!

But great Work to dany and all other coder here.


Best Regards

mav

Hi,

For those of you having problems displaying sub-forums on your homepage here is the fix.

Open includes/functions_forumlist.php

Look for the line that reads (around line 527):

$forum = $forumcache["$forumid"];

And below that add

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

That should do it :)

If you have any problems let me know and I'll see what I can do.

Now, search for every instance of

$userinfo['where']

which refers to the three $filename instances above and alter the <a href="... statement to match the rewritten display of your URLs...

examples

$userinfo['where'] = "<a href=\"f$forumid-" . mod_rewrite_title($forumtitle) . ".html\">$forumtitle</a>";
 
$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";
 
$userinfo['where'] = "<a href=\"post$postid.html#postid=$postid\" title=\"$threadpreview\">$threadtitle</a>";

There is a slight error in the code above.

Where it reads:

$userinfo['where'] = "<a href=\"t$forumid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";

it should in fact read

$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";

:)

Basically, Using Cyber-SEO's code could someone make a way for navbar to work for Ted's/Keithmcl's method with the fX-keyword-keyword without mod-rewrite.

There is a slight error in the code above.

Where it reads:

$userinfo['where'] = "<a href=\"t$forumid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";

it should in fact read

$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";

:)

Thanks KeithMcL: Dani - can you please edit my post to rectify my typo?

I noticed that when you go to click on the latest post, the target url is "newpostinthread3.html" but when you click it, it links you to "showthread.php?p=3#post3" so did I do something wrong? Yet when you are viewing the forum and click on that thread, it shows "thread3.html"

And also, I want to fix the Online Location problem, but Natch's solution was too hard for me to figure out, so is there an easier way? Or one that goes into more detail so I can figure it out?

Wow. Tremendous hack.

I have a dumb question though: I don't suppose you also have a handy-dandy redirect that will point my .html pages back to the .php ones, in the event that I'm not able to keep this hack up to date...? When I was using invisionboard a while back I'd used a hack similar to this one and it worked fine, but over time I wasn't able to keep all of the necessary edits going and soon abandoned. Unfortunately, I had spiders looking for .html pages for quite some time...

hi. just for a test i put the following into the .htaccess file in the root dir of my forum:

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

but that made no difference whatsoever. no links changed anywhere. my hoster says that there is a workin mod_rewrite on the servers, but how come nothing works?

ps: my forum is on a subdomain.

Have you modified any vBulletin PHP script files, or any templates?

I noticed that when you go to click on the latest post, the target url is "newpostinthread3.html" but when you click it, it links you to "showthread.php?p=3#post3" so did I do something wrong? Yet when you are viewing the forum and click on that thread, it shows "thread3.html"

And also, I want to fix the Online Location problem, but Natch's solution was too hard for me to figure out, so is there an easier way? Or one that goes into more detail so I can figure it out?

http://www.daniweb.com/tutorials/12725.html

hello,

can someone tell me what´s the differences between Dani´s Tutorial and Keith´s Tutorial?

greetz MaTriX

I originally started with my tutorial. Then Ted S expanded on my ideas. Then Keith took my original tutorial, and combined it with Ted's ideas, and put it all together as a new tutorial.

What about sessionid in URLs, aren't they got lost resulting in only cookie-users can login?

I originally started with my tutorial. Then Ted S expanded on my ideas. Then Keith took my original tutorial, and combined it with Ted's ideas, and put it all together as a new tutorial.

Thank you!

I have tested this hack, but when I upload the ".htaccess" I get an "Error 500". What does this mean? What should I do?

Greetz MaTriX

ok, got it to work.
now, when i was going through the tutorial:

Find all instances of:

PHP Code:
<a href="showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a>

And replace with:

PHP Code:
<a href="t$threadid-" .mod_rewrite_title($threadtitle). ".html\" title=\"$threadpreview\">$threadtitle</a>

Find all instances of:

PHP Code:
<a href="forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a>

And replace with:

PHP Code:
<a href="f$forumid-" .mod_rewrite_title($forumtitle). ".html\">$forumtitle</a>

couldn't find any of those instances in my functions_online.php :(

Thank you!

I have tested this hack, but when I upload the ".htaccess" I get an "Error 500". What does this mean? What should I do?

Greetz MaTriX

You should check over every edit you have made in your .htaccess file: if you make the slightest mistake, errors in this file will cause a 500 Internal Server Error

Question... I have not installed v3 Articles 1.0.1 - [vB 3.0.1] or vB Journal3.0.3(v1.0.0) yet but I would like to know if it will do a mod_rewrite for them as well? Sorry if this is a dumb question... no clue how they work without the install yet

OK - any hack can be recoded to work along the same lines as this one: for the person thqt asked, I have done vBadvanced CMPS modules to work with this standard, and it works well... (www.mobileforces.org for a working demo) - other hacks similarly...

it's been a long time since the [Revised] vBulletin Mod_rewrite Tutorial has been published, and nobody has noticed an error in it. weird. anyway, in the File Edits part there are 2 mistakes:

Find all instances of:

PHP Code:
<a href="showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a> 

And replace with:

PHP Code:
<a href="t$threadid-" .mod_rewrite_title($threadtitle). ".html\" title=\"$threadpreview\">$threadtitle</a> 

Find all instances of:

PHP Code:
<a href="forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a> 

And replace with:

PHP Code:
<a href="f$forumid-" .mod_rewrite_title($forumtitle). ".html\">$forumtitle</a>

should be

Find all instances of:

PHP Code:
<a href=[b]\[/b]"showthread.php?$session[sessionurl]t=$threadid\" title=\"$threadpreview\">$threadtitle</a> 

And replace with:

PHP Code:
<a href="t$threadid-" .mod_rewrite_title($threadtitle). ".html\" title=\"$threadpreview\">$threadtitle</a> 

Find all instances of:

PHP Code:
<a href=[b]\[/b]"forumdisplay.php?$session[sessionurl]f=$forumid\">$forumtitle</a> 

And replace with:

PHP Code:
<a href="f$forumid-" .mod_rewrite_title($forumtitle). ".html\">$forumtitle</a>

please edit the tutorial.

now a question. i wanted my forum links to look a bit different, so instead of using

[i]<a href="t$threadid-" .mod_rewrite_title($threadtitle). ".html\" title=\"$threadpreview\">$threadtitle</a>[/i]

and

[i]<a href="f$forumid-" .mod_rewrite_title($forumtitle). ".html\">$forumtitle</a>[/i]

i used

[i]<a href=\"thread/$threadid\" title=\"$threadpreview\">$threadtitle</a>[/i]
[i]and <a href=\"forum/$forumid\">$forumtitle</a>[/i]

so all my links to threads would look like thread/[threadid] and the links to forums would look like forum/[forumid]. however, in the Who's Online if i am viewing some forum, for example with id of 1, in the location column it says "Unknown Location /forum/1". it shows the threads fine, but not forums for some weird reason. any help there?

regards.

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.