•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 456,564 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,560 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 71633 | Replies: 238
![]() |
•
•
Join Date: Aug 2004
Location: Southern California
Posts: 40
Reputation:
Rep Power: 5
Solved Threads: 0
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:
[php]
// do light bulb
$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
[/php]
and below that add
[php]
// added by dani
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
// added by dani
[/php]
2) Edit the forumdisplay.php
Search for:
[php]
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
[/php]
and below that add
[php]
// added by keith
$thread['url'] = strtolower(str_replace(" ", "-", $thread['threadtitle']));
$thread['url'] = ereg_replace("[/?!.$%£()~*@]+", "", $thread['url']);
// added by keith
[/php]
3) Use the following code in your .htaccess file:
You may need to use [R] flags if you have the quick style chooser enabled.
4) Edit the threadbit template
Search for:
5)
Within the FORUMHOME template group:
forumhome_forumbit_level1_nopost
forumhome_forumbit_level1_post
forumhome_forumbit_level2_nopost
forumhome_forumbit_level2_post
forumhome_subforumbit_nopost
forumhome_subforumbit_post
All need to be replaced with the following:
Apply these changes in conjunction with the other changes listed here and you will have one killer SEO hack!
1) Edit the functions_forumlist.php file
Search for:
[php]
// do light bulb
$forum['statusicon'] = fetch_forum_lightbulb($forumid, $lastpostinfo, $forum);
[/php]
and below that add
[php]
// added by dani
$forum['url'] = strtolower(str_replace(" ", "-",str_replace("/", "-", $forum['title'])));
// added by dani
[/php]
2) Edit the forumdisplay.php
Search for:
[php]
$thread = process_thread_array($thread, $lastread, $foruminfo['allowicons']);
[/php]
and below that add
[php]
// added by keith
$thread['url'] = strtolower(str_replace(" ", "-", $thread['threadtitle']));
$thread['url'] = ereg_replace("[/?!.$%£()~*@]+", "", $thread['url']);
// added by keith
[/php]
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!
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!
Class Info:
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
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
Class Info:
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
•
•
Join Date: Aug 2004
Location: Southern California
Posts: 40
Reputation:
Rep Power: 5
Solved Threads: 0
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:
[php]
case 'thread.html':
if (isset($values['goto']) AND $values['goto'] == 'lastpost')
{
$userinfo['activity'] = 'forumdisplay';
}
else
{
$userinfo['activity'] = 'showthread';
}
break;
[/php]
Of course that doesnt work since its thread ID .html , how should i got about getting this to work?
[php]
case 'thread.html':
if (isset($values['goto']) AND $values['goto'] == 'lastpost')
{
$userinfo['activity'] = 'forumdisplay';
}
else
{
$userinfo['activity'] = 'showthread';
}
break;
[/php]
Of course that doesnt work since its thread ID .html , how should i got about getting this to work?
Class Info:
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
•
•
Join Date: Aug 2004
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
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
)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
•
•
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,020
Reputation:
Rep Power: 33
Solved Threads: 117
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: http://www.daniweb.com/linktous.php - 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
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: http://www.daniweb.com/linktous.php - 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
Dani the Computer Science Gal
Do you run a computer-related website? Feature it in our niche link directory!
Do you run a computer-related website? Feature it in our niche link directory!
•
•
Join Date: Aug 2004
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
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
.
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...
Class Info:
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
Warrior Priest | Bright Wizard |Witch Hunter | Rune Priest |Engineer | Hammerer |Ironbreaker | Black Orc |Orc Choppa | Goblin Shaman |Squig Herder | Chosen |Magus | Zealot | Marauder
![]() |
•
•
•
•
•
•
•
•
DaniWeb PHP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- [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



Linear Mode