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)

fastforward 05-24-2001 10:00 PM

For vB 2.0

This little hackette is a quick fix to allow search engine bots to spider your threads.

Although this will allow the bots to index every thread on your site, it will not make the threads 'search engine optimized'. They will see exactly what you see when you visit your site. It simply removes the CGI bits from the URL's which prevents most search engine bots from spidering more than one level deep.

If you want a hack that allows to fully customize how the thread will look to the search engine bot, you should look at Overgrows more complete hack here.

The advantage of this hack over Overgrows is that it does not require htaccess support which can have performance issues. This could also be seen as a disadvantage though as my hack requires that you have mod_rewrite enabled on your Apache Server, whereas Overgrows method should work with just about any web host out there.

Take yer pick :D

eva2000 05-25-2001 05:45 AM

got a demo/example url for us ?

fastforward 05-25-2001 12:36 PM

Quote:

Originally posted by eva2000
got a demo/example url for us ?
http://dbforums.com

You can see the forum links on the front page are like :

http://dbforums.com/f5/s



and the threads are like:

http://dbforums.com/t44153/s.html

Overgrow 05-25-2001 03:17 PM

Hey very cool.. I haven't looked at the code yet, but nice job.

One note though: The main point of my hack is getting Google to the archives, not really friendly URLs.. that was just a sidenote. The archiving is what I'm after.

eva2000 05-25-2001 11:06 PM

yeah cool but do normal showthreads and forumdisplay urls still work ?

i.e would a url like http://animeboards.com/forumdisplay.php?s=&forumid=2 still work as well as

http://animeboards.com/f2/s ?

fastforward 05-25-2001 11:27 PM

Quote:

Originally posted by eva2000
yeah cool but do normal showthreads and forumdisplay urls still work ?

i.e would a url like http://animeboards.com/forumdisplay.php?s=&forumid=2 still work as well as

http://animeboards.com/f2/s ?

hehe. Oh ye of little faith

Yeah they do. :)

The only urls that are trapped by the mod_rewrite directives are ones that match one of these three expressions:
Code:

^/f([0-9]+)/s([^/]+?)$
^/t([0-9]+)/s([^/]+?)\.html$
^/s([^/])+?/$

ie.
/f234/s or /f234/s345345detr3
/t2343/s.html or /t2343/s435345.html
/s/ or /s435345345dfsdf/

Actually I need to clarify in the docs that this assumes your forums are in the web root. Those directives should be prefixed with /forums/ or wherever if your vB is installed elsewhere.

eva2000 05-25-2001 11:28 PM

cool.. yet another hack i'm gonna add hehe

eva2000 05-25-2001 11:30 PM

oh wait any problems you can see running both overgrow's search engine spidering hack and yours together ? i also use htacess to use mod_rewrite to prevent hot linking of my forum images

fastforward 05-26-2001 01:04 AM

Quote:

Originally posted by eva2000
oh wait any problems you can see running both overgrow's search engine spidering hack and yours together ? i also use htacess to use mod_rewrite to prevent hot linking of my forum images
No problems at all. I just installed Overgrows :)

http://dbforums.com/archive/

I did make one change to Overgrows though so that I wouldn't need to use .htaccess files. I deleted the .htaccess and added this to my httpd.conf:
Code:

RewriteRule ^/archive/.* /archive/index.php [L]
But either method will work.

eva2000 05-26-2001 01:42 AM

Quote:

Originally posted by fastforward

No problems at all. I just installed Overgrows :)

http://dbforums.com/archive/

I did make one change to Overgrows though so that I wouldn't need to use .htaccess files. I deleted the .htaccess and added this to my httpd.conf:
Code:

RewriteRule ^/archive/.* /archive/index.php [L]
But either method will work.

okay great then :)

eva2000 05-26-2001 01:52 AM

okay i already have mod_rewrite so what do i do for the first step something like this ?

Quote:

<VirtualHost 157.238.46.185>
ServerAdmin webmaster@animeboards.net
DocumentRoot /home/usr1/public_html
BytesLog domlogs/animeboards.net-bytes_log
ServerName www.animeboards.net
ServerAlias animeboards.com *.animeboards.com
CustomLog domlogs/animeboards.net combined
ScriptAlias /cgi-bin/ /home/usr1/public_html/cgi-bin/
RewriteEngine on
RewriteRule ^/f([0-9]+)/s([^/]+?)$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^/t([0-9]+)/s([^/]+?)\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^/s([^/])+?/$ /index.php?s=$1 [L]
</VirtualHost>

fastforward 05-26-2001 01:59 AM

That's correct as long as your foums are in the web root. If not, you need to change those to something like:
Code:

RewriteRule ^/forums/t([0-9]+)/s([^/]+?)\.html$ /showthread.php?threadid=$1&s=$2 [L]

eva2000 05-26-2001 02:02 AM

okay gonna implement this now hehe

eva2000 05-26-2001 02:38 AM

okay installed one problem i sthe showthread links for

Go to first unread post go to

http://animeboards.com/# now
also

Admin options for

split

merge

move

stick/unstick threads all don't work

as well as view mod queue, view attachment queue etc

they are redirect to my front page since i have an htaccess for error redirects to my front page

fastforward 05-26-2001 02:51 AM

Quote:

Originally posted by eva2000
okay installed one problem i sthe showthread links for

Go to first unread post go to

http://animeboards.com/# now
Not sure what you mean here.
Quote:

also

Admin options for

split

merge

move

stick/unstick threads all don't work

as well as view mod queue, view attachment queue etc

they are redirect to my front page since i have an htaccess for error redirects to my front page
I really can't see how the changes could in anyway affect these. You did only change the links in the forumhome and forumdisplay templates right?

The links you're talking about don't even point to pages that use these templates. they are still in their original form and point to postings.php.

eva2000 05-26-2001 02:57 AM

Quote:

Originally posted by fastforward

Not sure what you mean here.

I really can't see how the changes could in anyway affect these. You did only change the links in the forumhome and forumdisplay templates right?

The links you're talking about don't even point to pages that use these templates. they are still in their original form and point to postings.php.

well i'm using the drop downmenu version of the admin options

for the other problem i.e.

this thread the link to

http://vbulletin.com/forum/showthrea...114233#newpost

goes to

http://vbulletin.com/forum/# on my forum

fastforward 05-26-2001 03:07 AM

Show me the Rewrite directives you put in your httpd.conf.

And what's this admin drop down options thingy you're talking about?

And the only templates changed were the ones in the instructions. One occurance in each template?

eva2000 05-26-2001 03:09 AM

okay i fixed the goto new or unread thread link by editing the showthread_firstunread template

Quote:

<a href="showthread.php?s=$session[sessionhash]&threadid=$threadid$newpostlink">Go to first unread post</a> <a href="showthread.php?s=$session[sessionhash]&threadid=$threadid$newpostlink"><img src="{imagesfolder}/firstnew.gif" border="0" alt="first unread" align="absmiddle"></a>
but it seems the admin options drop down menu takes the relavtive url of the thread

so if it's

http://animeboards.com/showthread.php?s=&threadid=18752

it will work but

http://animeboards.com/t18752/s.html will

look for

http://animeboards.com/t18752/s.html/postings.php or something

eva2000 05-26-2001 03:12 AM

these

eva2000 05-26-2001 03:12 AM

and this

fastforward 05-26-2001 03:12 AM

Did you put the baseurl tag in the header template. That should stop those errors. You may need to alter it slightly to reflect your forum directory.

What is this drop down admin menu? Is it with the new templates? I still need to revert some of mine from RC3.

eva2000 05-26-2001 03:13 AM

Quote:

Originally posted by fastforward
Did you put the baseurl tag in the header template. That should stop those errors. You may need to alter it slightly to reflect your forum directory.

What is this drop down admin menu? Is it with the new templates? I still need to revert some of mine from RC3.

yes base url is in head insert already

i think if you revert your templates you'll know what i'm talking about

eva2000 05-26-2001 03:20 AM

template showthread_adminoptions contains
Code:

<table cellpadding="0" cellspacing="0" border="0">
<form action="postings.php" method="get"><tr><td>
<smallfont>
<input type="hidden" name="s" value="$session[dbsessionhash]">
<input type="hidden" name="threadid" value="$threadid">
<b>Admin Options:</b><br>
<select name="action" onchange="window.location=('postings.php?s=$session[dbsessionhash]&action='+this.options[this.selectedIndex].value+'&threadid=$threadid')">
<option value="editthread" selected>-- Thread Options --</option>
<option value="openclosethread">Open / Close Thread</option>
<option value="move">Move / Copy Thread</option>
<option value="editthread">Edit Thread</option>
<option value="deletethread">Delete Thread / Posts</option>
<option value="merge">Merge Threads</option>
<option value="split">Split Thread</option>
<option value="stick">Stick / Unstick Thread</option>
</select>
<input type="image" src="images2/go.gif" border="0" align="absbottom">
</smallfont>
</td></tr></form>
</table>

and forumdisplay_adminoptions
Code:

<table cellpadding="0" cellspacing="0" border="0">
<form action="moderator.php" method="get"><tr><td>
<smallfont>
<input type="hidden" name="s" value="$session[sessionhash]">
<input type="hidden" name="forumid" value="$forumid">
<b>Admin Options:</b><br>
<select name="action" onchange="window.location=('moderator.php?s=$session[sessionhash]&forumid=$forumid&action='+this.options[this.selectedIndex].value)">
<option value="modposts" selected>-- Forum Options --</option>
<option value="modposts">View Posts Queue</option>
<option value="modattach">View Attachment Queue</option>
<option value="move">Mass Move</option>
<option value="prune">Mass Prune</option>
</select>
<input type="image" src="images2/go.gif" border="0" align="absbottom">
</smallfont>
</td></tr></form>
</table>


fastforward 05-26-2001 03:20 AM

hmmm. Not sure about that then. Sorry. Maybe I'd better not revert my templates. My text admin options work :D

What about the forum jump? If that fails on yours then the problem can be fixed within the templates. That dropdown works on mine.

fastforward 05-26-2001 03:21 AM

Just prefix the postings.php reference in those templates with the $ bburl variable. ie $ bburl/postings.php..etc

eva2000 05-26-2001 03:24 AM

Quote:

Originally posted by fastforward
hmmm. Not sure about that then. Sorry. Maybe I'd better not revert my templates. My text admin options work :D

What about the forum jump? If that fails on yours then the problem can be fixed within the templates. That dropdown works on mine.

forum jump does NOT work when used on http://animeboards.com/f1/s but works on the real url

eva2000 05-26-2001 03:30 AM

Quote:

Originally posted by fastforward
Just prefix the postings.php reference in those templates with the $ bburl variable. ie $ bburl/postings.php..etc
yay that worked now for the other people trying this

template showthread_adminoptions
Code:

<table cellpadding="0" cellspacing="0" border="0">
<form action="postings.php" method="get"><tr><td>
<smallfont>
<input type="hidden" name="s" value="$session[dbsessionhash]">
<input type="hidden" name="threadid" value="$threadid">
<b>Admin Options:</b><br>
<select name="action" onchange="window.location=('$bburl/postings.php?s=$session[dbsessionhash]&action='+this.options[this.selectedIndex].value+'&threadid=$threadid')">
<option value="editthread" selected>-- Thread Options --</option>
<option value="openclosethread">Open / Close Thread</option>
<option value="move">Move / Copy Thread</option>
<option value="editthread">Edit Thread</option>
<option value="deletethread">Delete Thread / Posts</option>
<option value="merge">Merge Threads</option>
<option value="split">Split Thread</option>
<option value="stick">Stick / Unstick Thread</option>
</select>
<input type="image" src="images2/go.gif" border="0" align="absbottom">
</smallfont>
</td></tr></form>
</table>

and forumdisplay_adminoptions
Code:

<table cellpadding="0" cellspacing="0" border="0">
<form action="moderator.php" method="get"><tr><td>
<smallfont>
<input type="hidden" name="s" value="$session[sessionhash]">
<input type="hidden" name="forumid" value="$forumid">
<b>Admin Options:</b><br>
<select name="action" onchange="window.location=('$bburl/moderator.php?s=$session[sessionhash]&forumid=$forumid&action='+this.options[this.selectedIndex].value)">
<option value="modposts" selected>-- Forum Options --</option>
<option value="modposts">View Posts Queue</option>
<option value="modattach">View Attachment Queue</option>
<option value="move">Mass Move</option>
<option value="prune">Mass Prune</option>
</select>
<input type="image" src="images2/go.gif" border="0" align="absbottom">
</smallfont>
</td></tr></form>
</table>

forumjump template
Code:

<table cellpadding="0" cellspacing="0" border="0">
<form action="forumdisplay.php" method="get"><tr><td>
<smallfont>
<input type="hidden" name="s" value="$session[sessionhash]">
<input type="hidden" name="daysprune" value="$daysprune">
<b>Forum Jump:</b><br>
<select name="forumid" onchange="window.location=('$bburl/forumdisplay.php?s=$session[sessionhash]&forumid='+this.options[this.selectedIndex].value+'&daysprune=$daysprune')">
<option value="-1" $defaultselected>Please select one:</option>
<option value="-1">--------------------</option>
<option value="pm" $frmjmpsel[pm]>Private messages</option>
<option value="search" $frmjmpsel[search]>Search</option>
<option value="home" $frmjmpsel[home]>Home</option>
<option value="-1">--------------------</option>
$jumpforumbits
</select>
<input type="image" src="{imagesfolder}/go.gif" border="0" align="absbottom">
</smallfont>
</td></tr></form>
</table>


fastforward 05-26-2001 03:31 AM

Quote:

Originally posted by eva2000
forum jump does NOT work when used on http://animeboards.com/f1/s but works on the real url
OK, then something isn't quite right with your setup as both work on mine. It was for this reason and the broken images that the baseurl tag was put in the header. I'm not sure what else to suggest. It has to be something to do with the baseurl.

eva2000 05-26-2001 03:32 AM

Quote:

Originally posted by fastforward

OK, then something isn't quite right with your setup as both work on mine. It was for this reason and the broken images that the baseurl tag was put in the header. I'm not sure what else to suggest. It has to be something to do with the baseurl.

all fixed now above previous post http://vbulletin.com/forum/showthrea...250#post114250 :)

fastforward 05-26-2001 03:35 AM

Quote:

Originally posted by eva2000
all fixed now above previous post http://vbulletin.com/forum/showthrea...250#post114250 :)
Yay... :D

Thanks mate.

I'll have to fix the docs and revert my templates tomorrow then.

eva2000 05-26-2001 03:49 AM

Quote:

Originally posted by fastforward

Yay... :D

Thanks mate.

I'll have to fix the docs and revert my templates tomorrow then.

thanks... one thing though with gzip and mod_gzip enabled i'm finding the shorter urls not being compressed on access compared to the real urls although it's being reported as gzipped at http://leknor.com/code/gziped.php

fastforward 05-26-2001 03:53 AM

Quote:

Originally posted by eva2000
one thing though with gzip and mod_gzip enabled i'm finding the shorter urls not being compressed on access compared to the real urls although it's being reported as gzipped at http://leknor.com/code/gziped.php
uhh..oh! You know, I actually did wonder if that would be a problem but I checked with leknor and as you mentioned that says it is gzipped. What are you using to determine it's not?

I seem to remember that when I first implemented this it seemed slower to load. That's what prompted me to check with leknor.com. I hope I can fix this. non-gzipped pages are not acceptable :(

eva2000 05-26-2001 03:57 AM

Quote:

Originally posted by fastforward

uhh..oh! You know, I actually did wonder if that would be a problem but I checked with leknor and as you mentioned that says it is gzipped. What are you using to determine it's not?

I seem to remember that when I first implemented this it seemed slower to load. That's what prompted me to check with leknor.com. I hope I can fix this. non-gzipped pages are not acceptable :(

simple browser/eye test

i loaded the shorter url page right click page properties

then loaded the real url and right click page properties and compared the 2 sizes

shorter url was 129kb and real url was 19kb

but both reported as 19kb when tested at leknor

eva2000 05-26-2001 04:06 AM

oh yeah another thing i;m using the Zend cache trial so with html pages they won't be cached right ?

fastforward 05-26-2001 04:08 AM

Quote:

Originally posted by eva2000
simple browser/eye test

i loaded the shorter url page right click page properties

then loaded the real url and right click page properties and compared the 2 sizes

shorter url was 129kb and real url was 19kb

but both reported as 19kb when tested at leknor

I don't trust the browser method.

When I do that on threads I get 81K for the short ones and not available for on the originals. And for the forumhome I get 56K with the short url and 58K with the long url. :confused:

fastforward 05-26-2001 04:10 AM

Quote:

Originally posted by eva2000
oh yeah another thing i;m using the Zend cache trial so with html pages they won't be cached right ?
Not sure. I don't think it will have any affect. Zend shouldn't know about the rewrite. The request is translated by Apache before it gets to the PHP engine or the Zend stuff.

I'm just guessing though, I don't really know.

eva2000 05-26-2001 05:51 AM

Quote:

Originally posted by fastforward

I don't trust the browser method.

When I do that on threads I get 81K for the short ones and not available for on the originals. And for the forumhome I get 56K with the short url and 58K with the long url. :confused:

okay tested it on my sister's pc and dialup connection and yup it's compressed the page shows 129kb but loads in 5 - 10 secs on 56k modem

fastforward 05-26-2001 03:50 PM

Just to be double sure I enabled gzip logging in my Apache logs. You'll be pleased to know that it all works and everything is compressed as usual :) All the exclude and include filters work aswell, based on the original urls).

fastforward 05-27-2001 04:15 PM

Someone alerted me to a Netscape problem when using this hack.

I seems that Netscape ignores the < BASE > tag.

Subsequently, any urls that do not start with a slash or a fully qualified domain will fail.

The solution is to go through all the showthread, forumhome and forumdisplay templates and prefix all relative HREF's with the $ bburl variable.

This means the hack isn't quite so 'quick and easy' after all :(

If someone knows why Netscape is doing this please let us know.

eva2000 05-28-2001 05:54 AM

Quote:

Originally posted by fastforward
Someone alerted me to a Netscape problem when using this hack.

I seems that Netscape ignores the < BASE > tag.

Subsequently, any urls that do not start with a slash or a fully qualified domain will fail.

The solution is to go through all the showthread, forumhome and forumdisplay templates and prefix all relative HREF's with the $ bburl variable.

This means the hack isn't quite so 'quick and easy' after all :(

If someone knows why Netscape is doing this please let us know.

really ? hmmmmm


All times are GMT. The time now is 01:07 PM.

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.02499 seconds
  • Memory Usage 1,863KB
  • 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
  • (9)bbcode_code_printable
  • (22)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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