View Full Version : Spider Friendly URL hack
krohnathlonman
09-26-2004, 10:00 PM
I've started using better URLs for the search engines and I'm looking for some advice on what templates to modify. I also don't have the multi page part working right currently so I could use some help on that.
I haven't figured out the part to go to specific posts quite yet but I thought I'd share what I have so far.
URLs for the threads now look like this:
http://www.iamnotageek.com/t-76948.html (http://www.iamnotageek.com/t-76948-1.html)
Insert this into your .htaccess file in your forum base directory.
RewriteEngine on
RewriteRule ^t-([0-9]+) showthread.php?t=$1 [L]
Now test it by using a URL like domain.com/forum/t-THREADID.html
If that shows the thread properly THEN go into your admincp and use the template search function. Do a search for showthread.php and start editing those templates to send people to these new URLs. Don't modify things like the next page links.
This could potentially raise CPU usage quite a bit but my site pulls a decent amount of people per day and I'm not noticing much of a spike in CPU usage.
This can also be done for forums. I've done it here http://iamnotageek.com/f-46.html
If I can get the next page system working right I'll get the full instructions together.
I think you need to elaborate a little bit more on what to do krohnathlonman users who do not know much about coding and stuff probably will not know what to modify ... I'm currently using a custom Mod-Rewrite in our forums, so far so good, you can always take a look at it and see what I'm talking about. However, just like you I havent been able to rewrite the Next-Previous pages...
if you find anything, I will sure implement it,
regards,
krohnathlonman
09-27-2004, 10:24 PM
Really about all that can be done is is the admincp use the search for templates and search for showthread.php and instead of the showthread.php?t=VARIABLE
insert t-VARIABLE.html
If I can figure out the multi page I'll get together some very specific docs for this. I'm working in the forums like this currently and I now have redirects in place for the old archive pages.
I'm working in the forums like this currently and I now have redirects in place for the old archive pages.
me too :)
joeychgo
09-28-2004, 03:59 AM
Huh??????????
I totally have no clue what your saying I should do, but im interested in the concept...........
djohn
09-28-2004, 07:23 AM
i'd like to see my forum links to look instead of http://www.forum.com/forums/showthread.php?&threadid=123, like this: http://www.forum.com/forums/thread/123
i think it looks much nicer. is that possible to make?
Huh??????????
I totally have no clue what your saying I should do, but im interested in the concept...........
I told you krohnathlonman, you need to explain and give some more details on how to inmplement this on a website... i'm sure many will appreciate it...
i'd like to see my forum links to look instead of http://www.forum.com/forums/showthread.php?&threadid=123, like this: http://www.forum.com/forums/thread/123
i think it looks much nicer. is that possible to make?
Yeah, that is what this mod does..
colicab-d
09-28-2004, 04:47 PM
Hmmm so how do we use this one then? Tis all a little confusing
I think you got to ask krohnathlonman,
He is the one that released this mod and i'm sure he will be able to help you better...
djohn
09-28-2004, 06:08 PM
Yeah, that is what this mod does..
that's not what i asked
krohnathlonman
09-29-2004, 01:20 AM
I've updated the first post with quite a bit more information.
Djohn it will NOT be creating URLS like that. It will be creating MUCH better URLs
Logikos
09-29-2004, 02:58 AM
Very nice, i can't wait till you figure out how to get all the links a .HTML file!! :)
krohnathlonman
09-29-2004, 03:21 AM
I'm working on it :) I'm having trouble finding where those breadcrumb links are created. I've posted a thread asking for help on this. I'm sure I'm only missing something small to make the multi page work right. I've just done the modifications to newthread and newreply so that they get sent to the right URLs now. I'm slowly tracking things down to eliminate all those nasty URLs.
Search engines are where I get most of my traffic from so everything I can possibly do to improve them I'm going after! I've been capturing quite a few big search phrases the past few months and I've found one that is seriously bringing in nearly 1k ppl/day and about 60 terms that bring in more than 1k ppl this month! I need to pick up the pace for winter when things hit their prime.
My .htaccess is now looking like this:
RewriteEngine on
RewriteRule ^t-([0-9]+)?-([0-9]+) showthread.php?t=$1&page=$2 [L]
RewriteRule ^t-([0-9]+) showthread.php?t=$1 [L]
RewriteRule ^f-([0-9]+) forumdisplay.php?f=$1 [L]
RewriteRule ^p-([0-9]+) showthread.php?p=$1 [L]
the first t- is my attempt at multi page support.
Logikos
09-29-2004, 03:30 AM
I'm working on it :) I'm having trouble finding where those breadcrumb links are created. I've posted a thread asking for help on this. I'm sure I'm only missing something small to make the multi page work right. I've just done the modifications to newthread and newreply so that they get sent to the right URLs now. I'm slowly tracking things down to eliminate all those nasty URLs.
Search engines are where I get most of my traffic from so everything I can possibly do to improve them I'm going after! I've been capturing quite a few big search phrases the past few months and I've found one that is seriously bringing in nearly 1k ppl/day and about 60 terms that bring in more than 1k ppl this month! I need to pick up the pace for winter when things hit their prime.
My .htaccess is now looking like this:
RewriteEngine on
RewriteRule ^t-([0-9]+)?(-[0-9]+) showthread.php?t=$1&page=$2 [L]
RewriteRule ^t-([0-9]+) showthread.php?t=$1 [L]
RewriteRule ^f-([0-9]+) forumdisplay.php?f=$1 [L]
RewriteRule ^p-([0-9]+) showthread.php?p=$1 [L]
the first t- is my attempt at multi page support.
Very kool, i can't wait till you figure the rest out.
krohnathlonman
09-29-2004, 03:39 AM
I edited my post above to include my NOW working multi page support! Here it is a second time just in case you're a lil slow....
RewriteRule ^t-([0-9]+)?-([0-9]+) showthread.php?t=$1&page=$2 [L]
If you know the templates you can now find the multi page references and get them working properly!
I used dreamweaver to search the entire vbulletin directory for the code $url which is used for redirects in things like the newthread and newpost. I modifed them slightly so now all redirects are working properly.
Yes this is running notes as I figure things out... I'm looking for help/suggestions. You will have to know a little bit about the templates and do a bit of thinking but everything you need to know to do this hack is posted in this thread. Step by Step instructions will be put together when I get things finalized.
Zachery
09-29-2004, 03:45 AM
I think Xenon has released somthing to this effect, and Dani released a very good tutorial about this, however ive never had issues with google properly spidering my pages. so i dont see how this makes vBulletin any more SE freindly then nit already is.
krohnathlonman
09-29-2004, 04:13 AM
Xenon released an archive.... This is quite different since its bringing addresses like that to the actual forum. I'm looking for Dani's Tutorial right now.... Can ya link me? not finding in the search on vb.com or .org
Friendlier URLs like this have shown to get better positioning in searches.
One of the key things with google is how many sites are linking to a URL.... Take the URL position benefit THEN tack on people linking to these URLs instead of the showthread.php?t=XXXXX type URLs and I BET you will see a benefit from this. This is not a "quick" fix by any means but eventually over time you will see the benefit.
The greatest example of a site getting killer search positioning primarily due to a mod like this is computercops
krohnathlonman
09-29-2004, 04:35 AM
in functions_forumdisplay.php
$totalpages = ceil($thread['totalposts'] / $pperpage);
// orignal line $address = "showthread.php?$session[sessionurl]t=$thread[threadid]";
$address = "t-$thread[threadid]";
$address2 = "$thread[highlight]";
$curpage = 0;
Then in the template threadbit_pagelink
<a href="$address-$curpage$address2.html">$curpage</a>
Next thing I have to track down is that top right navbar and correct those links.
krohnathlonman
09-29-2004, 05:03 AM
wow this is proving to be alot of work LOL for the top right links: showthread.php
$DB_site->free_result($posts);
unset($post);
DEVDEBUG("First Post: $FIRSTPOSTID; Last Post: $LASTPOSTID");
//Line 961
$pagenav = construct_page_nav($totalposts, "t-$threadid", "");
if ($thread['lastpost'] > $bbuserinfo['lastvisit'])
{
Then there's a couple mods in template pagenav this is what I did for the first page:
<if condition="$show['first']"><td class="alt1"><a class="smallfont" href="$address-1.html" title="$vbphrase[first_page] -
Do basically the same for last page and the next/previous links.
Template pagenav_pagelink has all the middle pages
This is it for tonight.... I'm done tinkering with this.... The breadcrumb is really the main thing I have left to do on my forum. Then hopefully somebody will help me with the step by step instructions.
Logikos
09-29-2004, 07:09 AM
Maybe you should just MOD_Rewrite like dbforums.com. -shurgs-
msimonds
09-29-2004, 12:27 PM
here is the link to Dani's mod_rewrite. I use it on my forums and it works perfectly
http://www.daniweb.com/techtalkforums/thread9379.html
58sniper
09-29-2004, 12:44 PM
mod_rewrite is how we pulled it off at http://www.gurusnetwork.com/discussion/
Keep in mind that you'll be touching a LOT of templates to complete it.
krohnathlonman
09-29-2004, 03:31 PM
This is using mod_rewrite guys..... Dani's tutorial has some good ideas, but I had already achieved everything I was trying to do before I saw it.....
I went about doing basically the same thing in a different way... I ended up hacking up more PHP files.
Logikos
09-30-2004, 10:39 PM
If you can Figure out how to make links the forumtitles, then it would be much more usefull to spider.
Instead of:
www.mysite.com/forum/forumdisplay.php?f=1
it could be :
www.mysite.com/forum/f-$forum[title].html
www.mysite.com/forum/f-site-announcements.html And replace spaces with a dash (-) an force all lowercase letter. The that will make vb3 true spider friendly!
msimonds
10-01-2004, 06:30 PM
If you can Figure out how to make links the forumtitles, then it would be much more usefull to spider.
Instead of:
www.mysite.com/forum/forumdisplay.php?f=1 (http://www.mysite.com/forum/forumdisplay.php?f=1)
it could be :
www.mysite.com/forum/f-$forum (http://www.mysite.com/forum/f-$forum)[title].html
www.mysite.com/forum/f-site-announcements.html (http://www.mysite.com/forum/f-site-announcements.html) And replace spaces with a dash (-) an force all lowercase letter. The that will make vb3 true spider friendly!
Danni's mod_rewrite already does this, there are two versions in her post!
It is easy to put in place and remove if so needed
Logikos
10-01-2004, 06:33 PM
Without having to edit the file everytime you need to add/delete a new forum.
msimonds
10-01-2004, 06:38 PM
yes you can do this! If you want help? Contact me on one of my IM's
msimonds
10-01-2004, 06:42 PM
I did my own forum and three others
check out this one that I did it to! http://www.sectalk.com/boards, it has many forums
* this is not my site!
krohnathlonman
10-01-2004, 08:54 PM
using the names in the URL is simple... Basically have the rewrite completely ignore the text after the f-28 then you can have f-28-Iamthekingof_myownworld.html if you want and all that it cares to parse is the f-28
Logikos
10-01-2004, 10:48 PM
Well it will spider much better if the forum names where in the URL.
http://www.google.com/search?hl=en&ie=UTF-8&q=f22-.html&btnG=Google+Search
http://www.google.com/search?hl=en&lr=&ie=UTF-8&q=first-gen-camaro&btnG=Search
How could i do this without always havin to hack the .htacess file every time.
msimonds
10-01-2004, 10:53 PM
http://www.sportsrant.com/forums/f289-anaheim-angels.html
http://www.sportsrant.com/forums/f292-baltimore-orioles.html
http://www.sportsrant.com/forums/f310-pittsburgh-pirates.html
These are examples from my forum, using the mod from Dani's tutorial with a few corrections.
This is the only content that is in my .htaccess file:
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]
I dont have to add a new line everytime I add a forum, the changes in Dani's mod already does that, with some help of another poster of there at her forums named Ted. I am willing to help anyone that needs it, just IM or PM me
It is really easy to put in place
Is this what you were asking, so you dont have to change the htaccess everytime you add or delete a forum
krohnathlonman
10-02-2004, 06:01 AM
its this line here that does it
RewriteRule ^f([0-9]+)-(.*).html$ forumdisplay.php?forumid=$1 [L]
the * means don't do any form of parsing of that :)
Logikos
10-02-2004, 06:52 AM
Thanks, i got it to work. Now im making it so threads are in the html. Like http://mysite.com/t-71.Spider-Friendly-URL-hack.html. and having it cut it out with long URLS.
what i have to do im Templates??
Template forumhome_lastpostby
<a href="showthread.php?$session[sessionurl]goto=newpost&t=$lastpostinfo[lastthreadid]" title="<phrase 1="$lastpostinfo[lastthread]">$vbphrase[go_first_unread_in_thread_x]</phrase>"><strong>$lastpostinfo[trimthread]</strong></a>
<a href="showthread.php?$session[sessionurl]goto=lastpost&t=$lastpostinfo[lastthreadid]"><img class="inlineimg" src="$stylevar[imgdir_button]/lastpost.gif" alt="$vbphrase[go_to_last_post]" border="0" /></a> What exactly do I have to change? Because the Sessionid is also important! :rolleyes:
Ruffneck
01-20-2005, 10:29 PM
Hi all, i´ve like this hack.
A little question, i´ve replace the link on a forumhome last topics template:
OLD WAS
<a href="showthread.php?$session[sessionurl]threadid=$thread[threadid]" title="$thread[preview]"><strong>$thread[title]</strong></a>
<em>$vbphrase[last_post]:</em> $thread[date]
NEW CODE
<a href="t-$thread[threadid]-$thread[title].html" title="$thread[preview]"><strong>$thread[title]</strong></a>
<em>$vbphrase[last_post]:</em> $thread[date]
Problem, the thread title was:
Willkommen, gabby
He makes: t-9020-Willkommen,%20gabby!.html
I don´t like ",%" on the url
Psycho Beat Project would be:
t-9019-Psycho%20Beat%20Project.html
I want replace signs like "" "," "." or "/20" with a "-" sign.
Example t-9019-Psycho-Beat-Project.html or much better
Psycho-Beat-Project.html
Update: I´ve created a $ttitle with replace string the signs like "!"...
I think it´s not the best way, because i must replace also $lastthread strings like "!" on the forumhome...
Sun Boy
03-30-2005, 11:36 AM
this is one of the most best hack i ever seen
i will start using it right now and i hope we could do the rest also so owre site's will be all from a to z HTML pages
i have a website that i made is spider friendly
it's 4images
see this
http://www.racing4e.com/index.html
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.