View Full Version : Spider friendly URLs
The Piper
03-24-2003, 03:12 AM
I'm having some issues with forumdisplay. Please check http://www.pinkfloydfan.net/f20.html and look at the page navigation. Click on any of them, say, page 2. I'm taken to an URL such as http://www.pinkfloydfan.net/forumdisplay.php?s=&forumid=20&daysprune=365&sortorder=&sortfield=lastpost&perpage=50-2.html, which does not work (that is, I'm shown the first page of the forum as well).
I'd really appreciate any input on this, please. I've changed everything according to this post (https://vborg.vbsupport.ru/showthread.php?postid=348137#post348137), and have already doublechecked it.
Thanks a lot,
Paulo
The Piper
03-25-2003, 03:31 AM
Ok, since the issues I brought up on my last post were also happening in other parts of the site (for instance, in the Control Panel, while choosing an avatar, users could not choose any page other than 2 - we've got lots of avatars), he would get an URL such as the one described on the past post.
I've just uninstalled all the parts of this hack that deal with page navigation and, of course, everything is working fine again. Of course search engines won't be indexing any pages other than page 1 of all of my threads, but at least everything is working.
If anyone got these problems and/or wants to try to fix them, I'll try to help.
Just thought I'd post my experiences here. :)
slinky
03-25-2003, 03:44 AM
There has to be an easy way of doing this... all my pages are html using the mod rewrite and I've made the mod a long, long time ago....
PurpleCow
03-25-2003, 01:41 PM
Hii all,
This is a TOP most important hack for vBulletin that was ever done and will be ever done ( might be ), if someone can get it to work with every aspect/page of vbulletin (incase it is yet to be done ?? ) !
I would want to use this hack on my yet to be launched forums and i'd like to know, if the attachment in the first post of this thread is a workiable version for this hack ?? If not kindly attach a file with instructions to get it to work !
I do have a suggestion for fastforward and all other lead developers, contributing developers and behind the scene developers :
Kindly contact Brett_tbake of WebMasterWorld (http://www.webmasterworld.com), who has successfully implemented this kind of hack for his forums. however, we should keep in mind that his forums are custom coded and not using vBulletin. but what i mean to say is that, he can sure give you some inputs to make this hack easy to use and get it to work.
I request one of you developers get in touch with him there at webmasterworld.com.
I do have another question :
My forums are installed in a subdomain, meaning.... http://xyz.mydomain.com and not /forums/ type of directory, if i have to get this to work, what if any changes should i make ??
Also, kindly some one give me a link to the thread for Overgorw's hack on this , none of the previously potsed url's work for me !
As a sidenote, i'd like to mention that i am using version 2.3.0, and i hope this hack works for this latest version ??
Thank you very much for working on this hack.
Cheers
slinky
03-25-2003, 02:01 PM
My hack seems to work. It's simple but I have no idea if they are being properly indexed. Search engines change their search methods over time and it is tough to track. I've been keeping my forums as is (my pages end in .html files) since it works and little hassle.
But hacks are hacks. A writer is under no obligation to provide support whatsoever so we have to live with it.
Today at 02:01 AM slinky said this in Post #255 (https://vborg.vbsupport.ru/showthread.php?postid=373054#post373054)
My hack seems to work. It's simple but I have no idea if they are being properly indexed. Search engines change their search methods over time and it is tough to track.
It looks like you have to register before you can browse your forums. This will also stop search engines from spidering your threads, in other words you may as well not have this hack installed :laugh:
cheers!
lierduh
03-25-2003, 09:45 PM
03-24-03 at 03:12 PM The Piper said this in Post #251 (https://vborg.vbsupport.ru/showthread.php?postid=372382#post372382)
I'm having some issues with forumdisplay. Please check http://www.pinkfloydfan.net/f20.html and look at the page navigation. Click on any of them, say, page 2. I'm taken to an URL such as http://www.pinkfloydfan.net/forumdisplay.php?s=&forumid=20&daysprune=365&sortorder=&sortfield=lastpost&perpage=50-2.html, which does not work (that is, I'm shown the first page of the forum as well).
I'd really appreciate any input on this, please. I've changed everything according to this post (https://vborg.vbsupport.ru/showthread.php?postid=348137#post348137), and have already doublechecked it.
Thanks a lot,
Paulo
That means the templates have not been changed properly. You should see f20-15-2.html or something like that when it is done properly.
amk35
03-31-2003, 07:01 AM
just curious....should the forumdisplay links look like:
forumdisplay.php?s=&forumid=14&daysprune=30&sortorder=&sortfield=lastpost&perpag e=40-3.html
?
All the other links are now short with no "?" symbols etc.
Thanks. Great work btw, much appreciated!
amk35
04-01-2003, 12:13 AM
Hi Lierduh
I'm having one problem with the hack. Clicking on any of the links at the bottom of forumdisplay (2,3,4 etc) brings up the same page, page 1. I saw someone else had this problem and I changed the rewrite rule as you suggested, but the problem still exists. Any ideas? Thanks.
lierduh
04-07-2003, 04:16 AM
04-01-03 at 01:13 PM amk35 said this in Post #259 (https://vborg.vbsupport.ru/showthread.php?postid=376152#post376152)
Hi Lierduh
I'm having one problem with the hack. Clicking on any of the links at the bottom of forumdisplay (2,3,4 etc) brings up the same page, page 1. I saw someone else had this problem and I changed the rewrite rule as you suggested, but the problem still exists. Any ideas? Thanks.
Please provide the problem URLs, you can remove the domain part if you do not want to reveal that. Please also provide the related rewrite rules.
(PS: Don't pay anyone until you do this, it could just be a simply fix.
https://vborg.vbsupport.ru/showthread.php?s=&postid=377090#post377090
)
amk35
04-07-2003, 02:51 PM
Lierduh,
Thanks for the response :)
At
http://domain.com/forums/f1.html
The links on the bottom to view older threads are as follows:
2 - http://domain.com/forums/forumdisplay.php?s=&forumid=1&daysprune=1000&sortorder=&sortfield=lastpost&perpage=40-2.html
3 - http://domain.com/forums/forumdisplay.php?s=&forumid=1&daysprune=1000&sortorder=&sortfield=lastpost&perpage=40-3.html
etc. All bring up the same initial forum page when clicked
My rewrite rules are:
RewriteEngine on
RewriteRule ^/forums/f([0-9]+)/?$ /forums/forumdisplay.php?forumid=$1 [L]
RewriteRule ^/forums/f([0-9]+)\.html$ /forums/forumdisplay.php?forumid=$1 [L]
RewriteRule ^/forums/f([0-9]+)-([0-9]+)\.html$ /forums/forumdisplay.php?forumid=$1&daysprune=1000&sortorder=&sortfield=lastpost&perpage=25&pagenumber=$2 [L]
RewriteRule ^/forums/t([0-9]+)\.html$ /forums/showthread.php?threadid=$1 [L]
RewriteRule ^/forums/t([0-9]+)-([0-9]+)-([0-9]+)\.html$ /forums/showthread.php?threadid=$1&perpage=$2&pagenumber=$3 [L]
RewriteRule ^/forums/t([0-9]+)-([0-9]+)--(.*)--([0-9]+)\.html$ /forums/showthread.php?threadid=$1&perpage=$2&highlight=$3&pagenumber=$4 [L]
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^/forums/memberlist.php$ /forums/memberlist.php?%1&pagenumber=%2? [L]
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^/forums/search.php$ /forums/search.php?%1&pagenumber=%2? [L]
Thanks for any help. BTW, I have no problem paying you for fixing it either :) I just need to get it working quickly. Thanks.
Allen
lierduh
04-09-2003, 11:16 AM
Looks like you have not edited the php file.
==== >8
open forumdisplay.php
Find
$pagenav =
getpagenav($totalthreads,"forumdisplay.php?s=$session[sessionhash]&forumid=$forumid&daysprune=$daysprune&sortorder=$sortorder&sortfield=$sortfield&perpage=$perpage");
replace it with:
$pagenav = getpagenav($totalthreads,"f$forumid");
====== >8
You need to find the php file (forumdisplay.php) and edit it according to my original post. You can put "//" without the quote in front of that line to comment out the old code and add the line of new code next line to it.
I will try to come back to this forum soon to see if you have fixed it. Thanks but no, I will not accept payment for something like this. :)
tpearl5
04-11-2003, 01:59 AM
I changed servers again and unfortunately I can't get this hack working. The server has ensim on the backend running redhat. In the .htaccess I have:
RewriteEngine on
RewriteRule ^f([0-9]+)/?$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^t([0-9]+).html$ /showthread.php?threadid=$1 [L]
RewriteRule ^t([0-9]+)-([0-9]+).html$ /showthread.php?threadid=$1&perpage=15&pagenumber=$2 [L]
RewriteRule ^f([0-9]+)-([0-9]+)/$ /forumdisplay.php?forumid=$1&daysprune=1000&sortorder=&sortfield=lastpost&perpage=40&pagenumber=$2 [L]
RewriteRule ^[ft]([0-9]+)/s([^/]*)/(.+)$ /$3 [L]
However this causes a forbidden message on all directory pages. It does not however effect http://board.midibuddy.net .. (the page still loads)
The board pages are at http://board.midibuddy.net
Please help! What could I possibly be doing wrong?
amk35
04-13-2003, 01:19 PM
lierduh,
Thanks very much. such a stupid oversight....works great now.
MarkG
04-30-2003, 04:15 PM
i've moved to a new server and this code doesnt work anymore for some reason
if it you can get it working either here's another way:
1) set a 404.php as your 404 handler in your .htacess or httpd.conf
ErrorDocument 404 /404.php
and put this in
<?
ob_start();
if ($ref=="") $ref=$REQUEST_URI;
if (preg_match ("#/forums/t\d*-s.html#",$ref)) {
$ref=str_replace("/forums/t","",$ref);
$ref=str_replace("-s.html","",$ref);
Header("Location: http://domain.com/forums/showthread.php?threadid=".$ref );
}
if (preg_match ("#/forums/f\d*-s.html#",$ref)) {
$ref=str_replace("/forums/f","",$ref);
$ref=str_replace("-s.html","",$ref);
Header("Location: http://domain.com/forums/forumdisplay.php?forumid=".$ref );
}
ob_end_clean();
?>
important: my forums are under /forums and i have my links like t4444-s.html not t4444/s555555.html (with a - not / and without the session number). change the code according to your situation
if anyone uses it, let me know if it works for you
ps. there one issue with this sollution: you still get a line in your error log about a missing file...
Slynderdale
06-25-2003, 08:09 AM
Is there a .htaccess version of this? I tried the rewrite rule in the first post and got a 500 internal error.
MrNase
07-13-2003, 01:15 PM
I don't get behind that mod_rewrite stuff :(
Could someone try to explaine what i should add to my .htaccess when i want to redirect:
http://www.mydomain.com/pages/index?firma=john borne
or
http://www.mydomain.com/pages/index?firma=iwonttellyou
to
http://www.mydomain.com/pages/john borne
or
http://www.mydomain.com/pages/iwonttellyou
??
thx in advance ;)
buro9
07-16-2003, 05:31 PM
I'm using Google AdSense to pay for my forum, and the side effect of having the ads on the site is that they send thousands of spiders to try and figure out what is going on and what contextual adverts to place.
So... to this thread I came.
Big thanks to fastforward and lierduh for all their work.
But... I have found a couple of small bugs... most of them I've ironed out (unfortunately they were painful to find so it took a while and I can't recall every little thing I've done)... but there is one that is lingering:
In forumdisplay.php, when I'm viewing a forum:
http://www.bowlie.com/forum/f2.html
If I sort the forum by the number of thread replies. It's fine.
But then if I page onto the second page of the results... it's forgotten that I wanted it sorted.
A user pointed this out to me... but in essence... forum sorting doesn't work under this system.
I'll try and figure it out myself, but I feel I'm not as versed in mod-rewrite and the subtleties as others here... so anyone who can help, please do :)
buro9
07-16-2003, 06:19 PM
OK, got it working again...
Here's the modification I made:
In forumdisplay.php lierduh changed:
$pagenav = getpagenav($totalthreads,"forumdisplay.php?s=$session[sessionhash]&forumid=$forumid&daysprune=$daysprune&sortorder=$sortorder&sortfield=$sortfield&perpage=$perpage
To:
$pagenav = getpagenav($totalthreads,"f$forumid");
And I've now changed it to:
$pagenav = getpagenav($totalthreads,"f$forumid--$daysprune--$sortfield--$sortorder");
Now... none of that is going to work without the rewrite rules... so I've added two more... but here are all the ones I have that relate to the forumdisplay.php file. Note that the first one is lierduh's original one:
#
# forumdisplay.php rewriting
#
# f2.html = forumid
RewriteRule ^f([0-9]+)\.html$ forumdisplay.php?forumid=$1 [L]
#
# f2--25--lastpost---2.html = forumid + daysprune + sortfield + sortorder + pagenumber
RewriteRule ^f([0-9]+)--([0-9]+)--([a-z]+)---([0-9]+)\.html$ forumdisplay.php?forumid=$1&daysprune=$2&sortorder=&sortfield=$3&perpage=25&pagenumber=$4 [L]
#
# f2--25--lastpost--asc-2.html = forumid + daysprune + sortfield + sortorder + pagenumber
RewriteRule ^f([0-9]+)--([0-9]+)--([a-z]+)--([a-z]+)-([0-9]+)\.html$ forumdisplay.php?forumid=$1&daysprune=$2&sortorder=$4&sortfield=$3&perpage=25&pagenumber=$5 [L]
Now all of the ordering stuff works on the page spanning, and the page spanning is easy to spider :)
buro9
07-16-2003, 06:27 PM
Just checked, and lierduh you also suffer from this bug... so I'll assume that everyone who has done this also suffers from it.
The change I've made isn't aesthetically pleasing, but it does work and stays true to the spider friendly purpose.
To summarise to those joining the end of this thread and wondering where to begin:
First, follow fastforward's instructions on the first page of this thread... you need to do this before anything else to be familiar with what is going on before it gets scarier:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=18035
Then follow lierduh's instructions within his post... there are several major improvements over the initial code.
https://vborg.vbsupport.ru/showthread.php?s=&postid=348137#post348137
If you're confident at this point and everything is working, then go through the whole codebase and replacing the relevant forumdisplay and showthread parts with the new format... stripping out sessionhashes as you go along (I've disabled the option in user prefs to not use cookies and made cookies compulsory).
Finally... to resolve the nagging bug about sorting and page spanning, do the stuff in my post above:
https://vborg.vbsupport.ru/showthread.php?s=&postid=418256#post418256
It's a lot of work, and certainly daunting. Would I attempt it if I were seriously unsure about this stuff? Nope. But if you are comfortable working with the template system and editing the php files... then the benefits of being spidered are considerable and can do a lot for your forum (increase members or increase advert revenue).
buro9
07-17-2003, 08:13 PM
I'm getting a bit carried away by this now, and someone needs to stop me :)
I've applied the same idea to assist with reducing bandwidth :)
In my .htaccess file I've added this:
#
# avatar.php rewriting
#
# av1-1053412959.gif = userid + dateline
RewriteRule ^av([0-9]+)-([0-9]+).gif$ avatar.php?userid=$1&dateline=$2 [L]
#
# attachment.php rewriting
#
# atp157156.gif = postid + extension
RewriteRule ^atp([0-9]+).([a-z]+)$ attachment.php?postid=$1 [L]
# att157156.gif = attachmentid + extension
RewriteRule ^att([0-9]+).([a-z]+)$ attachment.php?attachmentid=$1 [L]
And you should be able to figure the rest out ;)
Simply change all references of avatar.php?userid=$post[userid]&$post[dateline]... and variations, for av$post[userid]-$post[dateline].gif
Don't worry about the extension, the correct mime-type will be returned by the php... and that's whats important.
Then change template postbit_attachment so that the URL for attachments is this : atp$post[postid].$post[attachmentextension]
Note that this also sidesteps a bug in Mozilla whereby downloading a zip file from a php page would prompt a php file extension rather than zip.
I've been hacking for sure, and again I don't recall clearly every change I made. But if you got the gist of everything else in this thread then I've no doubt you can do this.
Essentially the point is that a lack of querystring allows the browser and proxies/caches to cache the avatars and attachments.
This obviously reduces bandwidth... and also reduces database load.
I have high hopes for this little addition to this very fine hack ;)
buro9
07-20-2003, 08:33 PM
One last bug fix.
If you use lots of standard avatars... then the page navigation over pages of avatars from member.php will be broken (you'll only ever get the first page)... so you will also need to insert this:
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^member.php$ member.php?%1&pagenumber=%2? [L]
That will be after lierduh's other corrective rewrites.
Erwin
07-21-2003, 02:14 AM
Btw, I am doing something similar in vB3 - it's a lot easier, since sessionhash is coded by itself now. :)
Ogmuk
07-22-2003, 12:58 AM
Thanks for the terrific job on the great hack guys. I'm one of the few who doesn't need to have their forums added to search engines, but it's great for everyone who uses Google AdSense to gain some revenue. I have a question, does anyone know how to get the sessionhashes removed from the navbits? i.e.:
My_vbulletin_board > Some_Forum > This_is_my_post
Listed near the top in each forum or post level page. This same problem affects the Forum Jump menu on the bottom left and no doubt many other pages, but from personal experience, these are most commonly used ones.
This is not interesting for those who use this hack purely to get their pages Googled but for those who're using this for AdSense sessionhashes nearly always means that you'll be getting charity placeholders for banners instead (since the crawler thinks that it hasn't cached the page to generate an appropriate banner).
It also looks like that if a link on the forum sends you back to the index any different from http://www.mywebsite.com/forums/index.php (i.e. http://www.mywebsite.com/forums/index.php?s= or just http://www.mywebsite.com/forums/) that it will generate placeholder banners too. Perhaps this can be avoided as well?
buro9
07-23-2003, 04:56 AM
My reason for all of this is AdSense... I'm not bothered about spidering at all.
I manually removed all mentions of 'sessionhash' as appropriate throughout the whole codebase (php & templates).
There's a few subtle ones that linger... for example in the replacement variables for the styles... modify the header to remove the sessionhash from the main image and core navigation.
The page nav bit is buried in admin/functions.php and you can remove the sessionhash from there.
I also then adjusted all of my user options and registration forms to remove the option to not use cookies. And modified the FAQ to say that cookies are compulsory.
buro9
07-23-2003, 04:59 AM
One thing to point out is that even when you successfully remove all sessionhashes... Google spiders still visit with one!
I think their software has learnt vb and just compensates and discards. But this didn't bother me because the lack of sessionhashes and querystrings does help with being cached by proxies (the particularly dumb ones that AOL seem to use). So there is a benefit to it... but not as much as you think there will be.
Erwin
07-23-2003, 10:04 AM
Today at 03:59 PM buro9 said this in Post #276 (https://vborg.vbsupport.ru/showthread.php?postid=419900#post419900)
One thing to point out is that even when you successfully remove all sessionhashes... Google spiders still visit with one!
What do you mean?
buro9
07-23-2003, 11:21 AM
Oh no, my mistake :)
In my online.php there was still a place where a sessionhash was being echoed and I incorrectly thought that the spiders were using a hash... but they're not... it's just the display to me of where the spider is that inserted the hash.
Ignore that last bit :)
Which is good... as now it clearly is working better than I thought.
Ogmuk
07-23-2003, 11:38 AM
Thanks for the reply Buro9. I wonder if it's possible to get a step-by-step guide how to remove all the sessionhashes on every page where it is needed. If you or anyone has that amount of spare time of course ;)
filburt1's beta script (https://vborg.vbsupport.ru/showthread.php?s=&threadid=50805&perpage=15&display=&pagenumber=1) looks like something that could work with AdSense too, this might be interesting to look into. Did anyone try anything like this out for AdSense?
EDIT: VB3 works like a charm with AdSense. I can't wait for RC1 (just like nearly everyone else here).
buro9
07-23-2003, 03:35 PM
Found another bug:
The admin function to merge threads did not work, because your thread URL's are now of a different format.
postings.php and the action 'domergethread' expected a URL with 'threadid=' in it. But if you've followed all instructions (!) your formats are more similar to:
http://www.bowlie.com/forum/t5249.html
and
http://www.bowlie.com/forum/t5249-15-3.html
So, to fix this, do this:
FIND (in postings.php):
$getthreadid=intval(substr($mergethreadurl,strpos( $mergethreadurl,"threadid=")+9));
And replace with:
// HACK : START : SPIDER FRIENDLY URLS
//$getthreadid=intval(substr($mergethreadurl,strpos( $mergethreadurl,"threadid=")+9));
$getthreadid = intval(preg_replace("/(^.*\/t)|(-[\d]+-[\d]+)|(\.html)/", "", $mergethreadurl));
// HACK : END : SPIDER FRIENDLY URLS
If your format is slightly different, modify the regexp pattern slightly ;)
All it's doing is stripping out the threadid from the new format URL and putting that in the variable in the same way the old code did.
As you'll note, I always leave old-code lying around commented out in case I ever want to roll-back... it's just my style... but if you trust my work you can delete that line.
I also always leave those START and END blocks in, so I can see what the hell I changed and why :)
Ogmuk, simply put... I started by using the template search to find all templates with 'sessionhash' in them. Then I edited each and every template (nigh on all of them) and removed the applicable code... which usually boils down to:
s=$session[sessionhash]
And that is buried in nearly all URL's and also in some hidden form fields.
Once removed from all templates, I then searched through all .php files in the root of the forum directories, and similarly replaced all sessionhashes. EXCEPT where I found $dbsession[sessionhash] as this was usually being written TO the cookie and wasn't being echoed.
You will have to read through each instance, but it's obvious that if it's appearing in a URL you can strip it out... but if it's in code then you'll probably want to keep it there.
And lastly... I have AdSense running on my site, and thought I'd share this last tip for you:
AdSense advises you not to place adverts on pages that you have to be logged on to view, or on search results pages. The former is because they'll never correctly spider it and serve relevant adverts (I bet you see ones for password cracking and security!), and the second is because the pages changes too frequently and by the time it's spidered it's useless. Both in effect will show inappropriate or public service adverts which do nothing for your revenue... and lower your click-throughs by increasing impressions... and also generate server load by sending too many spiders your way.
So... I've written some JavaScript to only put adverts on pages that I know I WANT to show AdSense adverts on... here it is for you :)
<script type="text/javascript">
var adPages = new Array(
'forumdisplay.php',
'index.php',
'announcement.php',
'showthread.php',
'calendar.php',
'donate.php',
'misc.php',
'memberlist.php',
'vbstats.php',
'member.php',
'forum/f',
'forum/t'
);
var returnAdvert = false;
var pageString = new String();
pageString = document.location.href;
for (var ii = 0; ii < adPages.length; ii++) {
if (pageString.indexOf(adPages[ii]) >= 0) {
returnAdvert = true;
break;
}
}
if (returnAdvert == false && document.location.href == "http://www.bowlie.com/forum/") {
returnAdvert = true;
}
if (returnAdvert == true) {
var google_ad_client='pub-9576666925012421';
var google_ad_width=468;
var google_ad_height=60;
var google_ad_format='468x60_as';
document.write('<scr'+'ipt type="text/javascr'+'ipt" language="JavaScr'+'ipt" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></scr'+'ipt>');
}
</script>
All you need to do is change my forum path to your full forum path and put in your ad_client code (otherwise I get your money!).
Hope all of that info helps everyone.
Cheers
David K
Ogmuk
07-23-2003, 04:47 PM
Thanks! I didn't even think about excluding the placeholding banners to raise the clickthrough percentage. Simple but great javascript.
lierduh
07-25-2003, 02:16 PM
07-17-03 at 06:27 AM buro9 said this in Post #270 (https://vborg.vbsupport.ru/showthread.php?postid=418257#post418257)
Just checked, and lierduh you also suffer from this bug... so I'll assume that everyone who has done this also suffers from it.
The change I've made isn't aesthetically pleasing, but it does work and stays true to the spider friendly purpose.
To summarise to those joining the end of this thread and wondering where to begin:
First, follow fastforward's instructions on the first page of this thread... you need to do this before anything else to be familiar with what is going on before it gets scarier:
...
.
buro9, I have edited my original post to include a link pointing to your post.
I might start to look into fixing the bugs you pointed out, only problem (or not for some) is the VB3 is around the corner...:)
PurpleCow
08-01-2003, 01:34 PM
If my forums are installed in a subdomain say http://forums.mydomaindomain.com and not the root or a subdirectory like this http://www.mydomain.com/forums , how do i proceed ??
Any special changes to be made ??
Thanks
lierduh
08-02-2003, 03:54 AM
Today at 01:34 AM HostBubble said this in Post #283 (https://vborg.vbsupport.ru/showthread.php?postid=422372#post422372)
If my forums are installed in a subdomain say http://forums.mydomaindomain.com and not the root or a subdirectory like this http://www.mydomain.com/forums , how do i proceed ??
Any special changes to be made ??
Thanks
Looks like you have not RTFM.:)
heynurse
08-17-2003, 06:04 PM
What an awesome hack and additional features added! Great job.
I was just thinking, would it be beneficial to your search engine listing to have maybe a keyword in the file name? For example instead of
http://yoursite.com/t24232.html
it could be something like:
http://yoursite.com/XXXXXXX-24232.html (replace XXXX with any keyword you wish.
I'm not too sure how beneficial this might be for rankings, but I've seen it mentioned several times that having keywords in file names is better for rankings? Would this be hard to do or practical? Do you think it would be beneficial?
Or maybe even pulling in the title of the thread into the file name?
Maybe I'm totally off base here and don't have a clue of what I'm talking about :) If so, just tell me so.
RewriteRule: cannot compile regular expression '^/f([0-9]+)/s([^/]+?)$'
Is all I get. Does that mean I am missing regex support in my mod_rewrite?
Nevermind, if anyone is looking for a fix:
https://vborg.vbsupport.ru/showthread.php?postid=190131#post190131
:D
Could someone (ehem, moderators) edit this and put the link to the post in the first post? ;)
iceman11111
08-26-2003, 11:00 PM
Ok, I have everything working but I have 1 question?
If you goto this thread:
http://www.intense-training.com/forums/t3457.html
and then goto the top of the page and click "General Discussion Board"
it goes to
http://www.intense-training.com/forums/forumdisplay.php3?forumid=12
instead of
http://www.intense-training.com/forums/f12.html
How can I fix that?
iceman11111
08-27-2003, 01:36 PM
bump for help!
buro9
08-28-2003, 04:33 AM
You can only resolve that by editing the PHP code.
Most of the links that are constructed use the templates... which you've already adjusted... but some use the PHP functions to generate the links... such as the pagination and bread crumb navigation bits.
I don't recall the precise change I did to have mine working... but you can emulate what I did by simply searching all of your PHP files for "forumdisplay" and then making the judgement call as to whether you should change that instance of it.
I think you're likely to find that bit in admin/functions.php though ;)
MrNase
10-12-2003, 08:00 AM
does this work for 2.3.2 without problems?
i need a .htaccess Version that works with 2.3.2. Please help me :(
mottokrosh
10-20-2003, 09:00 AM
Hey guys,
Having gone through this thread from the beginning to establish the definitive hack installation, the mention of vb3 caught my eye.
Will vb3 have spider-friendly URLs by default? If so, when is it coming out, any ideas? Is it possible to download a beta?
M.
gmarik
11-11-2003, 02:27 PM
Does this works for:
1) 2.3.2
2) vB3 beta 7 ?
buro9
11-11-2003, 05:13 PM
Does this works for:
1) 2.3.2yes
2) vB3 beta 7 ?
not with these precise instructions, but you could adjust it to make it work on any website... the reliance is an mod_rewrite and not any particular code underneath.
but being cautious... i'd say don't do this until VB gets out of beta... they'd be too many releases and too much pain re-implementing on each version in between
PurpleCow
12-09-2003, 04:56 AM
hello,
I am using this hack, ... lierduh's instructions in this post https://vborg.vbsupport.ru/showpost.php?p=348137&postcount=223 and its is working fine with some minor problems.
I have teh done exactly the same as you specified in that post excepting this change as i could not find that code in my online.php
In online.php, find:
$loc=preg_replace("/\?s=[a-z0-9]{32}(&)?/","?",$loc);
add the following lines:
$loc=preg_replace("/f(\d+).html/","forumdisplay.php?forumid=\$1",$loc);
$loc=preg_replace("/t(\d+).html/","showthread.php?threadid=\$1",$loc);
$loc=preg_replace("/t(\d+)-(\d+)-(\d+).html/","showthread.php?threadid=\$1",$loc);
Now the problem is, the multi page navigation.
Please check this page : http://hostmarket.hostbubble.com/f22.html
It does show the multiple pages, but when i clcik on the second page, it shows all the threads and there is no links at the bottom for next or previous page. What wrong have i done.
My forum is here : http://hostmarket.hostbubble.com
Thanks much for any help
Cheers
PurpleCow
12-09-2003, 06:19 AM
Okay, I think, i have solved the above mentioned problem and works fine.
However, i'll have to say that, what works on my forum is :
for multi page nav - this is the urls : t3-5.html and not of this type t3-15-5.html ... and actually this t3-5.html works fine. Is that okay and should not have any other problems ???
Okay, another request though :
is it possible to convert the forum jump url's and page navigation urls ( Marketplace > HostBubble Lounge > Suggestions & Feedback ) also to static using lierduh instructions and buro9 instructions.
Thanks much
iceman11111
12-11-2003, 08:38 PM
Help, found a little problem
When I try and Update my counters I get a error for:
Update Thread Info
Database error in vBulletin Control Panel 2.2.9:
Invalid SQL: UPDATE thread SET lastpost=1055471230,replycount=9,postusername='tla ne', postuserid='2575', lastposter='GYMBRAT',attach= WHERE threadid=1999
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE threadid=1999' at line 1
mysql error number: 1064
Date: Thursday 11th of December 2003 03:38:08 PM
Script: http://www.intense-training.com/forums/forums/admin/misc.php3
Referer: http://www.intense-training.com/forums/admin/misc.php3?action=chooser&s=
Thanks
iceman
lierduh
12-13-2003, 12:02 AM
Does this works for:
2) vB3 beta 7 ?
With the Beta 7, I have dropped the whole idea. There is too much to modify. I have adopted the easy way out: Kill the seesion ID, and be done with it.
Without the session ID, Googles etc will index the forums. Find sessions.php under includes. Note the codes already include disabling session ID for Googles. What I have done is:
diff sessions.php~ sessions.php
380,381c380,381
< if ($nosessionhash == 1 OR preg_match("#(google|slurp@inktomi)#si", $_SERVER['HTTP_USER_AGENT']))
< { // if user is working through cookies, blank out the sessionhash
---
> //if ($nosessionhash == 1 OR preg_match("#(google|slurp@inktomi)#si", $_SERVER['HTTP_USER_AGENT']))
> //{ // if user is working through cookies, blank out the sessionhash
385c385
< }
---
> /*}
392c392
<
---
> */
Basically I completely disabled the session ID. So the forums can be indexed by any search engine. So far no member has complained that cookies-on is the only way to use the board.
With forums used my rewriterules. It is essential to modify the rewriterules so that an old link to the f123.html etc still works, search engine will have your old URL for the forums and threads, you need to make sure they work. I have:
RewriteEngine on
RewriteRule ^f([0-9]+)\.html$ forumdisplay.php?f=$1 [L]
RewriteRule ^f([0-9]+)-([0-9]+)\.html$ forumdisplay.php?f=$1&page=$2&sort=lastpost&order=&pp=25&daysprune=1000 [L]
RewriteRule ^t([0-9]+)\.html$ showthread.php?t=$1 [L]
RewriteRule ^t([0-9]+)-([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&pp=$2&page=$3 [L]
lierduh
12-19-2003, 09:34 AM
I have noticed Google does not index the archive pages. Probably the contents of the url after the "index.php/" are ignored by Google. I have made a rewrite rule trying to overcome this.
RewriteRule ^arc/(.*)$ archive/index.php/$1 [L]
All I need to do is including the above to my existing rules, and find "footer" template, change "archive/index.php/" to "arc/".
Nothing else needs to be changed.
The actual url for Google to see will be:
http://www.mysite.com/arc/f-40
etc. Now if Google does not index this, I don't know what would they index.:)
(I am using v3 Gamma at the moment).
gmarik
12-25-2003, 07:44 AM
I'm been hacking vB2 for quite a long time (about two years), but still I could not figure out all about the re-write function that some vb board use. And now with vb3 Gamma things have changed. What I could really use would be:
1) every forum (forumdisplay.php?f=55, for example) has another field called "description", let's say "sport", for example.
2) every subforum can be called as /forums/sport and it goes right to it, with no ".php?f=" between them
3) it should be as an on/off option admin could choose from
Respect, Marco
NickRac
12-27-2003, 10:22 PM
I don't have a "httpd.conf" file...now what?
influence
12-30-2003, 01:43 PM
hey lierduh or anyone else, after installing this hack, now me and my members can't view threads over 30 days old and I did set all my forums to show threads from the beginning.
Can anyone please help me fix this because google wont be able to index pages that are older than 30 days even though I dont care about that but I want my members to be able to view their old post or bring old posts back up.
Please someone post a fix for this
eva2000
01-08-2004, 05:51 PM
Anyone got this working with vB3 RC2 ?
my forum urls are
forumdomain.com/f123/s
forumdomain/t234/s.html
my old rewrite rules for vB 2.3.x were
RewriteEngine on
RewriteRule ^/f([0-9]+)/?$ /forumdisplay.php?forumid=$1 [L]
RewriteRule ^/f([0-9]+)/s?$ /forumdisplay.php?forumid=$1 [L]
RewriteRule ^/t([0-9]+)\.html$ /showthread.php?threadid=$1 [L]
RewriteRule ^/t([0-9]+)/s([^/]?)\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^/s([^/\?]0-9)+/$ /index.php?s=$1 [L]
and my htaccess file already had the following
AddType text/x-server-parsed-html .html
AddType text/x-server-parsed-html .htm
Redirect /forums/ http://animeboards.com/index.php
ErrorDocument 404 http://animeboards.com/index.php
ErrorDocument 400 http://animeboards.com/index.php
ErrorDocument 401 /401.php
<Limit GET PUT POST>
order allow,deny
allow from all
deny from .paonline.com
deny from 216.220.160
deny from 216.220.161
deny from 216.220.162
deny from 216.220.163
deny from 216.220.164
deny from 216.220.165
deny from 216.220.166
deny from 216.220.167
deny from 216.220.168
deny from 216.220.169
deny from 216.220.170
deny from 216.220.171
deny from 216.220.172
deny from 216.220.173
deny from 216.220.174
deny from 216.220.175
deny from 12.148.196
deny from 12.148.209
</Limit>
i tried changing forumid and threadid to f= and t= but all i got was redirecting me to my main page..
so i gave up and tried looking for ways to use mod_rewrite to instead redirect to a file with message of the new url location using this code in url.php
<?php
//break referring url to pieces to get directory path
$refer = $_SERVER["HTTP_REFERER"];
$pieces = explode("/", $refer);
//break directory path to get forum or thread id value
$refer2 = $pieces[3];
$fid = substr($refer2, 1);
$tid = substr($refer2, 1);
echo "This page has moved...<br>";
echo "<b>from:</b> ";
echo $_SERVER["HTTP_REFERER"];
echo "<br>";
echo "<b>to: </b>";
if ($refer2[0] == f) {
echo "http://forumdomain.com/forumdisplay.php?f=$fid";
} elseif ($refer2[0] == t) {
echo "http://forumdomain.com/showthread.php?t=$tid";
} else {
// header("Location: http://forumdomain.com/index.php");
echo "error";
}
?>
Which i intended for if the referring url is forumdomain.com/f123/s, i can explode and extract the forum id or thread id. I could change the echo's to PHP header redirects later... but you see what i mean
but problem is if i use mod_rewrite such as
RewriteEngine on
RewriteRule ^/f([0-9]+)/?$ /url.php [T=application/x-httpd-php,L]
RewriteRule ^/f([0-9]+)/s?$ /url.php [T=application/x-httpd-php,L]
RewriteRule ^/t([0-9]+)\.html$ /url.php [T=application/x-httpd-php,L]
RewriteRule ^/t([0-9]+)/s([^/]?)\.html$ /url.php [T=application/x-httpd-php,L]
i end up with the referring url as not being http://forumdomain.com/f123/s but as the page which lists that url http://forumdomain.com/f123/s (i.e. search engine listing - it will show search engine's link as referring url)
any ideas ?
buro9
01-08-2004, 06:18 PM
Anyone got this working with vB3 RC2 ?
I wasn't sure whether I was going to implement the hack on VB3 as I'm less convinced that Google requires it nowadays, and the pain involved (I was *very* thorough in my implementation) when I have to upgrade the forum was too much for me to face (especially when urgent bug fixes came along).
However, it's a very sound theory still and does neaten the whole URL thing.
And because it's you who ask so soon eva2000 I'll look at it when I do my upgrade to VB3.
How comprehensive do we want it?
Last time it was reasonably comprehensive... but do we want to extend it to ALL URL's? Save for the form post ones obviously... just the ones that guests can get to... such as Member Profiles and Calendar entries as well as the Home, Forum, Thread, Post and top level pages.
Maybe this time we can get it all into one nice big (enormous ;)) install file.
Anyhow... I'll look into it soon... I have to renew my vBulleting subscription first! tsk!
For reference to others... here were the last iteration of the rewrite rules I was using on my server:
RewriteEngine on
RewriteBase /forum
#
# forumdisplay.php rewriting
#
# f2.html = forumid
RewriteRule ^f([0-9]+)\.html$ forumdisplay.php?forumid=$1 [L]
#
# f2--25--lastpost---2.html = forumid + daysprune + sortfield + sortorder + pagenumber
RewriteRule ^f([0-9]+)--([0-9]+)--([a-z]+)---([0-9]+)\.html$ forumdisplay.php?forumid=$1&daysprune=$2&sortorder=&sortfield=$3&perpage=25&pagenumber=$4 [L]
#
# f2--25--lastpost--asc-2.html = forumid + daysprune + sortfield + sortorder + pagenumber
RewriteRule ^f([0-9]+)--([0-9]+)--([a-z]+)--([a-z]+)-([0-9]+)\.html$ forumdisplay.php?forumid=$1&daysprune=$2&sortorder=$4&sortfield=$3&perpage=25&pagenumber=$5 [L]
#
# showthread.php rewriting
#
# t2.html = threadid
#
RewriteRule ^t([0-9]+)\.html$ showthread.php?threadid=$1 [L]
#
# t2-15-2 = threadid + perpage + pagenumber
RewriteRule ^t([0-9]+)-([0-9]+)-([0-9]+)\.html$ showthread.php?threadid=$1&perpage=$2&pagenumber=$3 [L]
#
# t2-15--friendster--2.html = threadid + perpage + highlight + pagenumber
RewriteRule ^t([0-9]+)-([0-9]+)--(.*)--([0-9]+)\.html$ showthread.php?threadid=$1&perpage=$2&highlight=$3&pagenumber=$4 [L]
#
# avatar.php rewriting
#
# av1-1053412959.gif = userid + dateline
RewriteRule ^av([0-9]+)-([0-9]+).gif$ avatar.php?userid=$1&dateline=$2 [L]
#
# attachment.php rewriting
#
# atp157156.gif = postid + extension
RewriteRule ^atp([0-9]+).([a-z]+)$ attachment.php?postid=$1 [L]
# att157156.gif = attachmentid + extension
RewriteRule ^att([0-9]+).([a-z]+)$ attachment.php?attachmentid=$1 [L]
#
# Correcting the page navigation where it is used in other parts of the forum.
#
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^memberlist.php$ memberlist.php?%1&pagenumber=%2? [L]
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^search.php$ search.php?%1&pagenumber=%2? [L]
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^member.php$ member.php?%1&pagenumber=%2? [L]
RewriteCond %{QUERY_STRING} ^(.*)-([0-9]+)\.html$
RewriteRule ^member2.php$ member2.php?%1&pagenumber=%2? [L]
As you may notice, I did attachments and avatars too, to assist proxies (specifically old AOL ones using HTTP1.0) in caching them... which prevents at least some bandwidth loss and database hits.
I was putting the datestamp of the avatar in the avatar URL so that each upload of a custom avatar would result in a unique URL :)
Anyway... I'll look at the VB3 possibilities once I get my license and a copy of the code... which should be in a week or two :)
Cheers
David K
eva2000
01-08-2004, 11:19 PM
thanks David.. i think to keep it simple to forum and thread links
forumdomain.com/f123/s
forumdomain/t234/s.html
i don't even mind if these redirect to the real longer url, just as long as they point to the respective forum id or thread id to keep my in-forum post referenced links valid (otherwise members who posted links using shorter urls in their past posts would all be invalid)
buro9
01-09-2004, 04:13 AM
That's even easier then ;)
I'll knock up something that does redirects so that your existing links in posts aren't broken :)
I'll try and do that this weekend... and that bit should be possible without the codebase :)
lierduh
01-11-2004, 10:16 AM
Anyone got this working with vB3 RC2 ?
my forum urls are
forumdomain.com/f123/s
forumdomain/t234/s.html
my old rewrite rules for vB 2.3.x were
RewriteEngine on
RewriteRule ^/f([0-9]+)/?$ /forumdisplay.php?forumid=$1 [L]
RewriteRule ^/f([0-9]+)/s?$ /forumdisplay.php?forumid=$1 [L]
RewriteRule ^/t([0-9]+)\.html$ /showthread.php?threadid=$1 [L]
RewriteRule ^/t([0-9]+)/s([^/]?)\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^/s([^/\?]0-9)+/$ /index.php?s=$1 [L]
any ideas ?
Bear in mind, the forumid= and threadid= url still work despite vB3 are using the short version as "f=" and "t=". So theoretically you don't even need to change your rules.
You might like to enable the rewrite log to debug the problem. I have an example at:
http://www.vbulletin.com/forum/showpost.php?p=580107&postcount=89
My current rulesets for the legacy links are posted here:
https://vborg.vbsupport.ru/showpost.php?p=451681&postcount=298
They have worked for me since beta 7, then Gamma, now RC2.
Also, if you disable the error redirects, I might be able to work out the problem if you provide a sample link.
For other people who is looking at doing this hack, I can't think of a reason to implement this hack in vB3. Just kill the session id in seesions.php, the bots will index the pages. Make sure to include a robots.txt file to exclude member.php etc!!!
buro9
01-23-2004, 02:54 PM
thanks David.. i think to keep it simple to forum and thread links
forumdomain.com/f123/s
forumdomain/t234/s.html
i don't even mind if these redirect to the real longer url, just as long as they point to the respective forum id or thread id to keep my in-forum post referenced links valid (otherwise members who posted links using shorter urls in their past posts would all be invalid)
OK, this is for eva2000 and then I'll go through what I'm doing to keep all my links lovely ;)
In your forum directory, set up your .htaccess to contain the following:
RewriteRule ^f([0-9]+)\/s$ forumdisplay.php?f=$1 [R=301]
RewriteRule ^t([0-9]+)\/s\.html$ forumdisplay.php?f=$1 [R=301]
Let me explain each part of those rules... well... one of them:
RewriteRule ARG1 ARG2 ARG3= If the URL requested matches the first arg, perform the second arg accord to the rules of the final arg.
ARG1 = Regular expression to match. In our case, ^f([0-9+])\/s$ where ^ = start of line, ([0-9]+ ) = 1 or more numbers, \/ = escaped forward slash (has to be escaped within a regexp), $ = end of line.
ARG2 = URL to request instead. In our case we also include $1 which is the first matching part of the regexp in ARG1 which is the number... the forumId.
ARG3 = Rule to dictate how to handle the ARG2 URL... [L] would bring it inline (leave the browser URL as it is and force the URL to the output stream without redirect)... I'm using [R=301] which is to send back a http 301 error which is "Moved Permanently"... I do this as I want Google and search engines to update all of their links over time and quite hitting the legacy ones.
So that's your solution eva ;) Though do bug me if I screwed that up... I've only just finally got round to it... and the 301 error may require a fully qualified URL and not a relative one.
Anyhow... this is now to help the people who are NOT upgrading their VB2 but, are doing a fresh install of VB3 at a new URL and are archiving their VB2. I'm not sure how many of these there will be... but our forum quite enjoys the zest of occassional re-births... and it will help to ensure that our VB3 threads are truly threaded from day 1.
So... I've got this URL at the moment:
http://www.bowlie.com/forum/
And I'm moving that forum to:
http://www.bowlie.com/2003/
And putting VB3 on the /forum/ URL.
Yes I have lots of VB licenses ;)
Anyhow... I want all t*.html links to go through to the archived forum... to keep all of the search engine results valid.
And I want all of the f*.html links to go through to the new forums on the new board.
The threads are easy to map:
#
# Legacy thread redirects
#
RewriteRule ^t([0-9]+)\.html$ http://www.bowlie.com/forum/showthread.php?threadid=$1 [R=301]
RewriteRule ^t([0-9]+)-([0-9]+)-([0-9]+)\.html$ http://www.bowlie.com/forum/showthread.php?threadid=$1&perpage=$2&pagenumber=$3 [R=301]
RewriteRule ^t([0-9]+)-([0-9]+)--(.*)--([0-9]+)\.html$ http://www.bowlie.com/forum/showthread.php?threadid=$1&perpage=$2&highlight=$3&pagenumber=$4 [R=301]
But the forums are harder.
The forumid's on both the old and new sites are different... so what was forumid = 4 on VB2 is now forumid = 11 on VB3. So I need a map to track these and then set up all of the RewriteRules.
I've created a javascript array of the forumids... where the first value is the VB2 forumid, and the second value is the VB3 forumid.
Some forums won't exist on my VB3 site... so those links will go through to the archive too.
I've then created a simple bit of JavaScript which when run from Internet Explorer (doesn't work in Mozilla as that is standards compliant ;)) will produce my rewriterules for me:
<script type="text/javascript">
var forums = new Array(
new Array('16','21'),
new Array('17','22'),
new Array('29',''),
new Array('33','29'),
new Array('4','11'),
new Array('30',''),
new Array('27','')
);
var html = "";
var oldForumUrl = "http://www.bowlie.com/2001/";
var newForumUrl = "http://www.bowlie.com/forum/";
for (var ii = 0; ii < forums.length; ii++) {
if (forums[ii][1] == '') {
// Link to archive
html += "RewriteRule ^f" + forums[ii][0] + "\\.html$ " + oldForumUrl + "forumdisplay.php?f=" + forums[ii][0] + " [R=301]\n";
html += "RewriteRule ^f" + forums[ii][0] + "--.*\\.html$ " + oldForumUrl + "forumdisplay.php?f=" + forums[ii][0] + " [R=301]\n";
} else {
// Link to new
html += "RewriteRule ^f" + forums[ii][0] + "\\.html$ " + newForumUrl + "forumdisplay.php?f=" + forums[ii][1] + " [R=301]\n";
html += "RewriteRule ^f" + forums[ii][0] + "--.*\\.html$ " + newForumUrl + "forumdisplay.php?f=" + forums[ii][1] + " [R=301]\n";
}
}
document.write("<plaintext>" + html);
</script>
Obviously modify the URLs as applicable to you.
The output can then be pasted into your .htaccess and you will have:
Legacy forum URLs for forums that exist on your new VB going to VB3
Legacy forum URLs for forums that don't exist on your new VB going to VB2
Legacy thread URLs going to your VB2
Google would start spidering your new VB3 links pretty soon, including the new thread ones.
Now... if all of that went straight over your head... just ignore it and don't do any of it ;) It's there to help other users that like me have installed this hack widely, indexed heavily by Google and are choosing to have a fresh VB3 and archive their VB2... that may be no-one else here... in which case... ignore this ;)
Logikos
01-29-2004, 03:50 PM
I don't own my own server yet, But my question is. does the the .htaccess file and httpd.conf file exsit on each domain registered on the server, or just one file alone for all domain being hosted by the provider? www.computerproblems.org is the site im refering to.
NTLDR
01-29-2004, 03:53 PM
http.conf is used for the global Apache configuration, this file only occurs once, you can specify per domain options in the relevent sections too. .htaccess is used for per directory (and any sub directory) options, so if placed in public_html (or similar) should effect the whole site unless another directory overrides the config.
Logikos
01-29-2004, 08:53 PM
Thanks, can this hack be used with just moding the .htaccess file only?
NTLDR
01-29-2004, 09:26 PM
I'm pretty sure it can, but I've never used it.
Logikos
01-29-2004, 10:33 PM
Anyone know how we would be able to use this with just the .htaccess file? I would love to have this hack on my boards, been seeing some great responds.
iceman11111
02-04-2004, 11:26 PM
Help!!!
I have installed all of the additions to this great hack, but I have one major problem!
When I goto Update my counters, I get a an error, trying to "Update Thread Info"
I get this
Database error in vBulletin Control Panel 2.2.9:
Invalid SQL: UPDATE thread SET lastpost=1055471230,replycount=9,postusername='tla ne', postuserid='2575', lastposter='GYMBRAT',attach= WHERE threadid=1999
mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE threadid=1999' at line 1
mysql error number: 1064
Date: Wednesday 04th of February 2004 06:26:13 PM
Script: http://www.intense-training.com/forums/forums/admin/misc.php3
Referer: http://www.intense-training.com/forums/admin/misc.php3?action=chooser&
eva2000
03-12-2004, 12:12 PM
OK, this is for eva2000 and then I'll go through what I'm doing to keep all my links lovely ;)
In your forum directory, set up your .htaccess to contain the following:
RewriteRule ^f([0-9]+)\/s$ forumdisplay.php?f=$1 [R=301]
RewriteRule ^t([0-9]+)\/s\.html$ forumdisplay.php?f=$1 [R=301]
Let me explain each part of those rules... well... one of them:
RewriteRule ARG1 ARG2 ARG3= If the URL requested matches the first arg, perform the second arg accord to the rules of the final arg.
ARG1 = Regular expression to match. In our case, ^f([0-9+])\/s$ where ^ = start of line, ([0-9]+ ) = 1 or more numbers, \/ = escaped forward slash (has to be escaped within a regexp), $ = end of line.
ARG2 = URL to request instead. In our case we also include $1 which is the first matching part of the regexp in ARG1 which is the number... the forumId.
ARG3 = Rule to dictate how to handle the ARG2 URL... [L] would bring it inline (leave the browser URL as it is and force the URL to the output stream without redirect)... I'm using [R=301] which is to send back a http 301 error which is "Moved Permanently"... I do this as I want Google and search engines to update all of their links over time and quite hitting the legacy ones.
So that's your solution eva ;) Though do bug me if I screwed that up... I've only just finally got round to it... and the 301 error may require a fully qualified URL and not a relative one.
Anyhow... this is now to help the people who are NOT upgrading their VB2 but, are doing a fresh install of VB3 at a new URL and are archiving their VB2. I'm not sure how many of these there will be... but our forum quite enjoys the zest of occassional re-births... and it will help to ensure that our VB3 threads are truly threaded from day 1.
So... I've got this URL at the moment:
http://www.bowlie.com/forum/
And I'm moving that forum to:
http://www.bowlie.com/2003/
And putting VB3 on the /forum/ URL.
Yes I have lots of VB licenses ;)
Anyhow... I want all t*.html links to go through to the archived forum... to keep all of the search engine results valid.
And I want all of the f*.html links to go through to the new forums on the new board.
The threads are easy to map:
#
# Legacy thread redirects
#
RewriteRule ^t([0-9]+)\.html$ http://www.bowlie.com/forum/showthread.php?threadid=$1 [R=301]
RewriteRule ^t([0-9]+)-([0-9]+)-([0-9]+)\.html$ http://www.bowlie.com/forum/showthread.php?threadid=$1&perpage=$2&pagenumber=$3 [R=301]
RewriteRule ^t([0-9]+)-([0-9]+)--(.*)--([0-9]+)\.html$ http://www.bowlie.com/forum/showthread.php?threadid=$1&perpage=$2&highlight=$3&pagenumber=$4 [R=301]
But the forums are harder.
The forumid's on both the old and new sites are different... so what was forumid = 4 on VB2 is now forumid = 11 on VB3. So I need a map to track these and then set up all of the RewriteRules.
I've created a javascript array of the forumids... where the first value is the VB2 forumid, and the second value is the VB3 forumid.
Some forums won't exist on my VB3 site... so those links will go through to the archive too.
I've then created a simple bit of JavaScript which when run from Internet Explorer (doesn't work in Mozilla as that is standards compliant ;)) will produce my rewriterules for me:
<script type="text/javascript">
var forums = new Array(
new Array('16','21'),
new Array('17','22'),
new Array('29',''),
new Array('33','29'),
new Array('4','11'),
new Array('30',''),
new Array('27','')
);
var html = "";
var oldForumUrl = "http://www.bowlie.com/2001/";
var newForumUrl = "http://www.bowlie.com/forum/";
for (var ii = 0; ii < forums.length; ii++) {
if (forums[ii][1] == '') {
// Link to archive
html += "RewriteRule ^f" + forums[ii][0] + "\\.html$ " + oldForumUrl + "forumdisplay.php?f=" + forums[ii][0] + " [R=301]\n";
html += "RewriteRule ^f" + forums[ii][0] + "--.*\\.html$ " + oldForumUrl + "forumdisplay.php?f=" + forums[ii][0] + " [R=301]\n";
} else {
// Link to new
html += "RewriteRule ^f" + forums[ii][0] + "\\.html$ " + newForumUrl + "forumdisplay.php?f=" + forums[ii][1] + " [R=301]\n";
html += "RewriteRule ^f" + forums[ii][0] + "--.*\\.html$ " + newForumUrl + "forumdisplay.php?f=" + forums[ii][1] + " [R=301]\n";
}
}
document.write("<plaintext>" + html);
</script>
Obviously modify the URLs as applicable to you.
The output can then be pasted into your .htaccess and you will have:
Legacy forum URLs for forums that exist on your new VB going to VB3
Legacy forum URLs for forums that don't exist on your new VB going to VB2
Legacy thread URLs going to your VB2
Google would start spidering your new VB3 links pretty soon, including the new thread ones.
Now... if all of that went straight over your head... just ignore it and don't do any of it ;) It's there to help other users that like me have installed this hack widely, indexed heavily by Google and are choosing to have a fresh VB3 and archive their VB2... that may be no-one else here... in which case... ignore this ;)
thanks buro9, sorry for the late reply my forum's server was down due to hardware failure since Jan 31 :o
gmarik
03-12-2004, 03:26 PM
This one would be good for vB3 ...
Haakon
04-20-2004, 08:41 AM
I agree, I really miss this hack. 300 extra guests are allways welcome you know ;), ANYONE successfully implemented this hack on vb3?
DenzoForums
04-21-2004, 04:35 PM
This looks cool.. I would like to install tis for VB 3.0.1. when or if it's available.
Dave
lierduh
04-21-2004, 11:46 PM
Please understand, there is no need for VB3 to have this hack.
The Archive system is designed to feed the robots. Besides the main forums are indexed by Googles etc due to the removal of session ID from the URL. The script detects spiders by its user agent and disables the session ID if found.
If anything, one might want to shorten the Archive's URL to potentially increase the ranking. eg.
/archive/index.php/f-35.html
to
/arc/f-35.html
This can be easily achieved by using rewrites.
DenzoForums
04-21-2004, 11:56 PM
My archives are not working.. not vbulletin problem, but apparently the sever i am hosted on doesn;t support some feature for that to work. Is there anything else i can do?
lierduh
04-22-2004, 01:21 AM
My archives are not working.. not vbulletin problem, but apparently the sever i am hosted on doesn;t support some feature for that to work. Is there anything else i can do?
The Archive needs to have:
AcceptPathInfo On
You can try this setting in .htaccess
Google for "AcceptPathInfo" and ".htaccess" may come back with more details.
DenzoForums
04-23-2004, 04:37 PM
Where does that go? anywhere in the .htaccess file?
What does it do?
When i click on the archive link, i get re-directed to my forumhome page. Is this to fix that?
Sorry.. I'm a bit confused..
Thanks
Dave
DenzoForums
04-24-2004, 03:35 PM
The Archive needs to have:
AcceptPathInfo On
You can try this setting in .htaccess
Google for "AcceptPathInfo" and ".htaccess" may come back with more details.
That didn't work..
anybody else have any suggestions?
lierduh
04-25-2004, 12:31 AM
That didn't work..
anybody else have any suggestions?
That directive should work in .htaccess according to:
http://httpd.apache.org/docs-2.0/mod/core.html
Have you checked google as I suggested? What have you tried? What problem you have had? what sort of error you have encountered?
Actually have you done a search at the forums of vbulletin.com? regarding archive or perhaps AcceptPathInfo.
Also read my post in this thread might help you to use .htaccess:
https://vborg.vbsupport.ru/showpost.php?p=348137&postcount=223
Others can only help you if you try for yourself and come back with more details.
DenzoForums
04-25-2004, 01:01 AM
actually, i have been looking into this.. I read in a few threads that acceptpathinfo will not work if your httpd.conf file is not allowing it.
I have posted here, and in vbulletin.com asking for some instruction on that file.
I do not see it in ftp, or SSH - although I am not handy with SSH and don't know where or how to look.
After some reading it seems I need to allow vB to override my apache settings in httpd.conf or this will not work. Unfortunately that is where I am stuck.
Does anyone know what needs to be changed in my httpd.conf to allow the AcceptPathInfo option to work?
This quote is from this thread from another person having same problem as me.
http://www.vbulletin.com/forum/showthread.php?t=90456
So what i need now is to find out how to edit that httpd.conf file, so it will allow the changes in .htaccess
Like I said before.. I have no idea where that file is, and if I can even get to it. My host does allow SSH access, but i do not know any commands. Dos commands not working :-)
Thanks
DAve
Haakon
04-26-2004, 09:50 AM
Denzo, the server httpd.conf file is probably in /etc/httpd/conf, and you can probably reach it with ssh (not ftp). You are not able to edit it though, but you can check if it is configed propperly
Concerning this hack and vB3. I`ve managed to add the rewrites to the forums, but not to the threads. I can`t find the clean
<a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]">$thread[title]</a>
I only find those with $highlight and $lastpost.
And pagenav url seems to be linked to a $address variable I can`t find.
I appreciate some help, as allways :)
DenzoForums
04-26-2004, 01:23 PM
Denzo, the server httpd.conf file is probably in /etc/httpd/conf, and you can probably reach it with ssh (not ftp). You are not able to edit it though, but you can check if it is configed propperly
Concerning this hack and vB3. I`ve managed to add the rewrites to the forums, but not to the threads. I can`t find the clean
<a href="showthread.php?s=$session[sessionhash]&threadid=$thread[threadid]">$thread[title]</a>
I only find those with $highlight and $lastpost.
And pagenav url seems to be linked to a $address variable I can`t find.
I appreciate some help, as allways :)
I found this <span class="smallfont" style="float:$stylevar[right]"><strong>$vbphrase[thread]</strong>: <a href="showthread.php?$session[sessionurl]t=$threadinfo[threadid]">$threadinfo[title]</a></span> in the newreply template.. but that's about it..
As far as me finding the httpd.conf file..No good. I am sure it's not onfigured right, becasue it's not working for me.. but so far I am unable to verify that..
Thanks
Dave
has anyone made this hack work for vb3.0.1?
Haakon
07-04-2004, 04:04 PM
RewriteEngine On
RewriteRule ^musicforum([0-9]+)\.html$ forumdisplay.php?f=$1 [L]
RewriteRule ^musicforum([0-9]+)-([0-9]+)\.html$ forumdisplay.php?f=$1&page=$2&sort=lastpost&order=&pp=20&daysprune=45 [L]
RewriteRule ^musicthread([0-9]+)\.html$ showthread.php?t=$1 [L]
RewriteRule ^musicthread([0-9]+)-([0-9]+)\.html$ showthread.php?t=$1&page=$2&pp=10 [L]
I`ve got these working (exchange musicforum and musicthread with your topics of course).
And basically just try the find the corresponding things in vb3 from what is described in lierduh`s post :
https://vborg.vbsupport.ru/showpost.php?p=348137&postcount=223
Try it, and if something specific comes up, I will try to help.
PS. Try one rule at a time.
cscgal
08-23-2004, 11:26 PM
Hey guys! I've written a detailed tutorial how to mod_rewrite vBulletin 3.
http://www.daniweb.com/techtalkforums/thread9379.html
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.