I really liked the idea of the titles in the url so I played aroung with modrewite and came up with this:

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

This tells modrewrite to forward any url fXID-XTEXT-.html to the forumdisplay.php?forumid=$XID url, this way you can have any text you want but since the ID is used in the URL, it is possible to use one rewrite rule for every forum.

To go along with this, you need to modify your forumbit templates to use the link

<a href="f$forum[forumid]-$forum[url].html">

No files need to be changed as far as I can recall.

So far I am testing this on a template that my users don't access so please confirm this works for you before putting it on a live site.

Thanks for the wonderful hack, I had limited spidering in the past and it worked wonders so I can only expect even better results from this deep spidering system.

Hello,

how can I use "titles in urls" for topics? Can you say me that? I have use it in my IPB and it's very sexy. :cheesy:

Thanks ;)

i have this running on my site, thanks for the great hack :)

hi cscgal. i know a little bit of html. can u brief me of wats a vbulletin in the first plac. guess i have a lo to learn yet

Sorry to be a pain but I would love this hack to work but I have obviously done something wrong :cool:

the forums come up correctly but I get a 404 error on every page. I have redone the hack from start three times now but the same thing always happens

You can see at www.forums.ic-games.co.uk

Any idea whats up? I have tried to read as much of this thread as I can put its getting on 12 pages and I may have missed something.

Any help appreciated

I have vbulletin 3.0.3.

I was looking at the instructions that you outlined in the first message of the thread. You stated to edit forumhome_forumbit_level1_nopost and use the following line:

<a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">

I looked at this file and it already contained this line. I have never edited this template before. Is your hack recommended for version 3.0.3?

Yes, it works for any version of vBulletin. I think that you musunderstood the instructions. It says to edit forumhome_forumbit_level1_nopost and FIND that line ... which apparently you did, and to replace it with something else.

Yes, it works for any version of vBulletin. I think that you musunderstood the instructions. It says to edit forumhome_forumbit_level1_nopost and FIND that line ... which apparently you did, and to replace it with something else.

Thanks for the prompt reply. Some questions...

1) Is it possible to give me an example of what I may replace that line with?

2) It looks like this thread is quite long. Are all of the suggested hacks in the first message of this thread?

Please ignore question #1. I saw the replace line of:

<a href="$forum.html">

at the end of the message.

Sorry to sound dumb here, but which mod works?
In other words do I follow the orignal, or the second one cscgal started? The one TedS did or do I combine the two?

My forum is new, and with no visitors to speak of now is a good time to get in and customise it, but errr I'm not sure which one I should do.

I notice there is another one started by another user. Do I use that one instead of this one?

I have applied the hacks suggested in this thread. If I go to my site, it shows html files (not php files) for all of the messages. So it looks like I applied this correctly. But I have noticed something that may not be working correctly:

1) If a message has multiple page listings and you select a page number, a showthread.php is selected instead of a html file.

2) Google has started to pickup my files. But is does show the listings with the following format:

showthread.php?t=205

My forum is located at http://www.politicalword.com/forum/index.php

Is this the way that this should work?

Your forum is working as expected. It will take Google 1-2 months to drop the old showthread.php URLs and replace them with your new .html URLs. Have patience, but be confident your site is being correctly and thoroughly spidered now.

Thanks for the reply. I'll wait a few months and see what happens.

I have noticed a new thread on mod_rewrite. Which thread is the preferred for seo?

Your forum is working as expected. It will take Google 1-2 months to drop the old showthread.php URLs and replace them with your new .html URLs. Have patience, but be confident your site is being correctly and thoroughly spidered now.

thanks alot for putting this together.. really good.

some question...
1.how do i write the thread's title on the html file instead the id number?
2.i wanna apply this to members as well, like member1.html ect... i have managed to do so but where do i need to change it so ppl will access it(like on forumhome) and to what?
3.it seems that some urls didnt work... i put a diffrent name of the html on a forum link in the .htaccess, but the forum shows something else that i have previously made and change... does it take time to php or something to update is links?
4.i have an home.php file which has extensions, like so: home.php?page="page_name".
i wanna have every extebsion to be an html file so it will just be: "page+name".html.

thx a bunch for all

I have a tricky twist on this tutorial. I'm getting ready to migrate my forums from an ASP system to PHP and vBulletin. I currently get a ton of traffic from search engines. How would I (could I?) use mod_rewrite to automatically redirect users from the old forum/thread URLs on my ASP-based site to the corresponding URLs on the new site?

I'm using vBulletin's ImPex tool to import the data (~90,000 posts and ~20,000 members).

I would ask your question over in our Apache forum, as your question doesn't pertain to vBulletin really, but simply standard URL redirection. This thread is just to discuss this particular hack :)

Hello,

I have installed this hack. I can get all parts to function properly except the part where on the forum home it becomes the actual forum name.html

What did I do wrong?

Hello,

I have installed this hack. I can get all parts to function properly except the part where on the forum home it becomes the actual forum name.html

What did I do wrong?

http://degster.com/
is the site with the problem, the only thing I can think of is I did something wrong with the forumhome...because it now has f1-main-category.html


btw...where is thed edit post function?

fantastic hack - got it working(finally!) :)
now all i have to do is wait for dr google to drop by with his hat on ;)

ive got this working

though one of my members noticed that threads with new posts arent appearing in bold. They appear bold in the new posts search page but not in the individual forum rooms

not sure why this has happened? Is it the threadbit that this needs to be amended or the forumdisplay?

thanks :)

ive got this working

though one of my members noticed that threads with new posts arent appearing in bold. They appear bold in the new posts search page but not in the individual forum rooms

not sure why this has happened? Is it the threadbit that this needs to be amended or the forumdisplay?

thanks :)

Updated threads not appearing in bold would not be affected by this hack. I would revert your threadbit template and reapply this hack to it. You probably made a typo and edited something there that you weren't supposed to.

i have

<a href="t$thread[threadid]-$thread[url].html"><if condition="$show['gotonewpost']"><strong>$thread[threadtitle]</strong><else />$thread[threadtitle]</if></a>

instead of the default

<a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]"><if condition="$show['gotonewpost']"><strong>$thread[threadtitle]</strong><else />$thread[threadtitle]</if></a>

do you need to add highlight into the first url?

merry crimbo!!! :cheesy:

RE: Who's Online Full Solution


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 :)

this works perfectly - cheers :)

Hey guys.

Great stuff, installed this a while back here:

http://www.tfw2005.com/boards/ works great.

I was wondering, could any help be given on this issue here:

http://www.vbulletin.org/forum/showthread.php?p=591361

I think it would help alot of people out. If you guys can do that, I can put together a package of templates and a modded article.php file that will allow for an archive look and feel, and probably work with Google.

Thanks!

Unfortunately I have no experience with any article system or hack available on vB.org. Perhaps someone else does, however.

One minor problem I still have, i've got a category for "tutorials" I want just that section to use tutorial[tid]-<name>-<name> instead of thread[tid]-name-name any ideas?

hello buddies,

i'm not sure whether my .htaccess is correct in that way:

.htacces:
-----------------------------------------------------------------
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]
-----------------------------------------------------------------

could maybe anyone take a look and tell me whether my file's right?

thanx in advance, michbeck

Thanks for the comprehensive tutorial. :)

However, I'm having problems with having commas and apostrophes in my forum topics at http://www.pokerplayertalk.com .

For example, it's including the comma in the URL because I have a comma in my forum title (see: http://www.pokerplayertalk.com/poker-chips,-cards-and-tables.html), any ideas on what I can do to fix this problem?

Here is my .htaccess:

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]

RewriteRule ^general-texas-holdem.html$ forumdisplay.php?f=1 [L]
RewriteRule ^texas-holdem-for-newbies.html$ forumdisplay.php?f=2 [L]
RewriteRule ^setting-up-home-games.html$ forumdisplay.php?f=3 [L]
RewriteRule ^texas-holdem-strategies.html$ forumdisplay.php?f=4 [L]
RewriteRule ^general-texas-holdem-strategy.html$ forumdisplay.php?f=5 [L]
RewriteRule ^no-limit-holdem-strategy.html$ forumdisplay.php?f=6 [L]
RewriteRule ^tournament-holdem-strategy.html$ forumdisplay.php?f=7 [L]
RewriteRule ^7-card-stud-and-omaha-strategy.html$ forumdisplay.php?f=8 [L]
RewriteRule ^poker-odds-probabilities.html$ forumdisplay.php?f=9 [L]
RewriteRule ^on-the-poker-table.html$ forumdisplay.php?f=10 [L]
RewriteRule ^bad-beats.html$ forumdisplay.php?f=11 [L]
RewriteRule ^hot-streaks.html$ forumdisplay.php?f=12 [L]
RewriteRule ^chip-tricks.html$ forumdisplay.php?f=13 [L]
RewriteRule ^poker-in-the-media.html$ forumdisplay.php?f=14 [L]
RewriteRule ^poker-news-and-gossip.html$ forumdisplay.php?f=15 [L]
RewriteRule ^poker-tv-and-movies.html$ forumdisplay.php?f=16 [L]
RewriteRule ^famous-poker-pros.html$ forumdisplay.php?f=17 [L]
RewriteRule ^poker-sites-and-products.html$ forumdisplay.php?f=18 [L]
RewriteRule ^online-poker-sites.html$ forumdisplay.php?f=19 [L]
RewriteRule ^poker-chips-cards-tables.html$ forumdisplay.php?f=20 [L]
RewriteRule ^poker-books.html$ forumdisplay.php?f=21 [L]
RewriteRule ^community-box.html$ forumdisplay.php?f=22 [L]
RewriteRule ^players-lounge.html$ forumdisplay.php?f=23 [L]
RewriteRule ^site-suggestion-&-support.html$ forumdisplay.php?f=24 [L]

Thanks in advance! :)

Hello,

Thank you CSC Gal! I have gone through steps 1 and 25 and have a problem that others have mentioned and solved in this thread, but I can't get it to work.

All of my links are displaying properly, but when I follow the links to, say, forum1.html, I get a 404 error. It is the same with the threads. I have a feeling it's a problem with the mod_rewrite. :confused:

The .htaccess file is in my forum root folder, and has the following information:

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

RewriteRule ^forum1.html$ forumdisplay.php?f=1 [L]

If anyone has any ideas as to how I can get this to work, I would greatly appreciate it!

Thank you,
Chris

A Solution and A Question

Firstly, i would like to Thank CSGAL for this great tutorial. But there are somethings that looks bad to me. That wrong thing is "View Full Version :" Links in Arhcive pages.

For example, in arhive pages you are redirecting to "forumdisplay.php?f=123" instead of thread123.html.

And

"forumdisplay.php?f=1" instead of "keyword.html".

i've solved the forumdisplay.php issue, here is the solution:

archive/index.php:

find:

echo print_archive_navigation($foruminfo, $threadinfo);

	echo "<p class=\"largefont\">$vbphrase[view_full_version] : <a href=\"$vboptions[bburl]/showthread.php?t=$threadinfo[threadid]\">$threadinfo[title]</a></p>\n<hr />\n";

and replace with

echo print_archive_navigation($foruminfo, $threadinfo);

	echo "<p class=\"largefont\">$vbphrase[view_full_version] : <a href=\"$vboptions[bburl]/thread$thread$threadinfo[threadid].html\">$threadinfo[title]</a></p>\n<hr />\n";

That will prevent duplicate pages which may crucial for SEO. And Your "View Full Version :" links will be "thread123.html".


BUT

i couldnt solve the "forumdisplay.php?f=1" instead of "keyword.html" issue. How may i fix that problem, i just added // to :

echo print_archive_navigation($foruminfo);

	echo "<p class=\"largefont\">$vbphrase[view_full_version] : <a href=\"$vboptions[bburl]/forumdisplay.php?f=$foruminfo[forumid]\">$foruminfo[title]</a></p>\n<hr />\n";

i hope somebody help and everything work GREAT with this tutorial.

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.