vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Spider friendly URLs (https://vborg.vbsupport.ru/showthread.php?t=18035)

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/forumdispla...page=40-2.html

3 - http://domain.com/forums/forumdispla...page=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&sortord er=&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=$sess ion[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:

PHP Code:

RewriteEngine on 
RewriteRule 
^f([0-9]+)/?$ /forumdisplay.php?forumid=$1&s=$[L
RewriteRule ^t([0-9]+).html$ /showthread.php?threadid=$[L]
RewriteRule ^t([0-9]+)-([0-9]+).html$ /showthread.php?threadid=$1&perpage=15&pagenumber=$[L]
RewriteRule ^f([0-9]+)-([0-9]+)/$ /forumdisplay.php?forumid=$1&daysprune=1000&sortorder=&sortfield=lastpost&perpage=40&pagenumber=$[L]
RewriteRule ^[ft]([0-9]+)/s([^/]*)/(.+)$ /$[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
Code:

ErrorDocument 404 /404.php
and put this in
Code:

<?
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:
PHP Code:

$pagenav getpagenav($totalthreads,"forumdisplay.php?s=$session[sessionhash]&forumid=$forumid&daysprune=$daysprune&sortorder=$sortorder&sortfield=$sortfield&perpage=$perpage 

To:
PHP Code:

$pagenav getpagenav($totalthreads,"f$forumid"); 

And I've now changed it to:
PHP Code:

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

Code:

  #
  # 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/showthrea...threadid=18035

Then follow lierduh's instructions within his post... there are several major improvements over the initial code.

https://vborg.vbsupport.ru/showthrea...137#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/showthrea...256#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).


All times are GMT. The time now is 07:33 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01358 seconds
  • Memory Usage 1,774KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete