User Name Password Register
DaniWeb IT Discussion Community
All
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
Reply
Join Date: Aug 2004
Location: Southern California
Posts: 40
Reputation: Ted S is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
Ted S Ted S is offline Offline
Light Poster

Re: vBulletin mod_rewrite

  #41  
Aug 27th, 2004
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:
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!
Reply With Quote  
Join Date: Aug 2004
Posts: 177
Reputation: YoungCoder is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
YoungCoder's Avatar
YoungCoder YoungCoder is offline Offline
Junior Poster

Re: vBulletin mod_rewrite

  #42  
Aug 27th, 2004
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!
Reply With Quote  
Join Date: Aug 2004
Posts: 177
Reputation: YoungCoder is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
YoungCoder's Avatar
YoungCoder YoungCoder is offline Offline
Junior Poster

Re: vBulletin mod_rewrite

  #43  
Aug 27th, 2004
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
Reply With Quote  
Join Date: Aug 2004
Location: Southern California
Posts: 40
Reputation: Ted S is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 0
Ted S Ted S is offline Offline
Light Poster

Re: vBulletin mod_rewrite

  #44  
Aug 27th, 2004
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.
Reply With Quote  
Join Date: Aug 2004
Posts: 177
Reputation: YoungCoder is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
YoungCoder's Avatar
YoungCoder YoungCoder is offline Offline
Junior Poster

Re: vBulletin mod_rewrite

  #45  
Aug 28th, 2004
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?
Reply With Quote  
Join Date: Aug 2004
Posts: 7
Reputation: 1EightT is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
1EightT 1EightT is offline Offline
Newbie Poster

Re: vBulletin mod_rewrite

  #46  
Sep 1st, 2004
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
Reply With Quote  
Join Date: Aug 2004
Posts: 7
Reputation: 1EightT is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
1EightT 1EightT is offline Offline
Newbie Poster

Re: vBulletin mod_rewrite

  #47  
Sep 1st, 2004
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.
Reply With Quote  
Join Date: Feb 2002
Location: Lawn Guylen, NY
Posts: 11,020
Reputation: cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice cscgal is just really nice 
Rep Power: 33
Solved Threads: 117
Admin
Staff Writer
cscgal's Avatar
cscgal cscgal is offline Offline
The Queen of DaniWeb

Re: vBulletin mod_rewrite

  #48  
Sep 1st, 2004
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
Reply With Quote  
Join Date: Aug 2004
Posts: 7
Reputation: 1EightT is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
1EightT 1EightT is offline Offline
Newbie Poster

Re: vBulletin mod_rewrite

  #49  
Sep 1st, 2004
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 .
Reply With Quote  
Join Date: Aug 2004
Posts: 177
Reputation: YoungCoder is an unknown quantity at this point 
Rep Power: 5
Solved Threads: 2
YoungCoder's Avatar
YoungCoder YoungCoder is offline Offline
Junior Poster

Re: vBulletin mod_rewrite

  #50  
Sep 2nd, 2004
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...
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 5:46 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC