| | |
vBulletin mod_rewrite
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
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):
[php]$forum = $forumcache["$forumid"];[/php]And below that add
[php]// added by keith
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
// added by keith[/php]That should do it
If you have any problems let me know and I'll see what I can do.
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):
[php]$forum = $forumcache["$forumid"];[/php]And below that add
[php]// added by keith
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
// added by keith[/php]That should do it

If you have any problems let me know and I'll see what I can do.
•
•
Join Date: Sep 2004
Posts: 7
Reputation:
Solved Threads: 0
I used Cyber-SEO's little hack for the nav bar but have found a problem...
For some reason on page http://www.cardschat.com/t19-%5Bblog...-showdown.html
it only links to main-category.html not f1-main-category.html typa thing, any ideas?
For some reason on page http://www.cardschat.com/t19-%5Bblog...-showdown.html
it only links to main-category.html not f1-main-category.html typa thing, any ideas?
•
•
•
•
Originally Posted by Natch
Now, search for every instance of [php]$userinfo['where'][/php]which refers to the three $filename instances above and alter the <a href="... statement to match the rewritten display of your URLs...
examples
[php]$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>";[/php]
Where it reads:
[php]$userinfo['where'] = "<a href=\"t$forumid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]it should in fact read
[php]$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]
Last edited by cscgal; Oct 17th, 2004 at 11:23 pm.
•
•
Join Date: Oct 2004
Posts: 16
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by KeithMcL
There is a slight error in the code above.
Where it reads:
[php]$userinfo['where'] = "<a href=\"t$forumid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]it should in fact read
[php]$userinfo['where'] = "<a href=\"t$threadid-" . mod_rewrite_title($threadtitle) . ".html\" title=\"$threadpreview\">$threadtitle</a>";[/php]
Natcher00 ... is the Admin @ MobileForces.org - Official Community for a cult Vehicle based FPS - the only place for support!
[vB.org] PNG24 transparency with IE * DaniWeb: mod_rewrite your vB
[vB.org] PNG24 transparency with IE * DaniWeb: mod_rewrite your vB
Just to let everyone know, Keith was generous enough to have rewritten this tutorial combining my hack as well as Ted's.
http://www.daniweb.com/tutorials/12725.html
http://www.daniweb.com/tutorials/12725.html
•
•
Join Date: Oct 2004
Posts: 1
Reputation:
Solved Threads: 0
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?
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...
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...
•
•
Join Date: Oct 2004
Posts: 3
Reputation:
Solved Threads: 0
hi. just for a test i put the following into the .htaccess file in the root dir of my forum:
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.
PHP Syntax (Toggle Plain Text)
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]
ps: my forum is on a subdomain.
![]() |
Similar Threads
- [Revised] vBulletin Mod_rewrite Tutorial (PHP)
- vBulletin mod_rewrite for vB 3.0.7 (Existing Scripts)
- vBulletin mod_rewrite for vB 3.0.7 (Growing an Online Community)
- vBulletin mod_rewrite in phpBB mod format (Existing Scripts)
Other Threads in the PHP Forum
- Previous Thread: Help Needed
- Next Thread: mysql_num_rows warning
| Thread Tools | Search this Thread |
advanced apache api array beginner binary broken cakephp check checkbox class cms code cookies cron curl database date datepart display dropdownlist dynamic echo email eregi error execution file files folder form forms function functions google head href htaccess html if...loop image include includingmysecondfileinthechain insert ip javascript job joomla jquery key library limit link login mail menu mlm multiple mysql oop password paypal pdf pdfdownload php phpvotingscript problem query radio random recursion remote screen script search server sessions smarty sms sorting source space sql startup stored syntax system table traffic tutorial unicode update upload url validator variable video web youtube zend






