View Full Version : [RELEASE] Spider friendly URLs
fastforward
Thu 24th May '01, 11:26pm
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 (http://www.vbulletin.com/forum/showthread.php?s=&threadid=15628).
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
Fri 25th May '01, 3:45am
got a demo/example url for us ?
fastforward
Fri 25th May '01, 10:36am
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
Fri 25th May '01, 1:17pm
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
Fri 25th May '01, 9:06pm
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
Fri 25th May '01, 9:27pm
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:
^/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
Fri 25th May '01, 9:28pm
cool.. yet another hack i'm gonna add hehe
eva2000
Fri 25th May '01, 9:30pm
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
Fri 25th May '01, 11:04pm
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:
RewriteRule ^/archive/.* /archive/index.php [L]
But either method will work.
eva2000
Fri 25th May '01, 11:42pm
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:
RewriteRule ^/archive/.* /archive/index.php [L]
But either method will work. okay great then :)
eva2000
Fri 25th May '01, 11:52pm
okay i already have mod_rewrite so what do i do for the first step something like this ?
<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
Fri 25th May '01, 11:59pm
That's correct as long as your foums are in the web root. If not, you need to change those to something like:
RewriteRule ^/forums/t([0-9]+)/s([^/]+?)\.html$ /showthread.php?threadid=$1&s=$2 [L]
eva2000
Sat 26th May '01, 12:02am
okay gonna implement this now hehe
eva2000
Sat 26th May '01, 12:38am
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
Sat 26th May '01, 12:51am
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.
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
Sat 26th May '01, 12:57am
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/showthread.php?s=&postid=114233#newpost
goes to
http://vbulletin.com/forum/# on my forum
fastforward
Sat 26th May '01, 1:07am
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
Sat 26th May '01, 1:09am
okay i fixed the goto new or unread thread link by editing the showthread_firstunread template
<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
Sat 26th May '01, 1:12am
these
eva2000
Sat 26th May '01, 1:12am
and this
fastforward
Sat 26th May '01, 1:12am
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
Sat 26th May '01, 1:13am
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
Sat 26th May '01, 1:20am
template showthread_adminoptions contains
<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
<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
Sat 26th May '01, 1:20am
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
Sat 26th May '01, 1:21am
Just prefix the postings.php reference in those templates with the $ bburl variable. ie $ bburl/postings.php..etc
eva2000
Sat 26th May '01, 1:24am
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
Sat 26th May '01, 1:30am
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
<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
<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
<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
Sat 26th May '01, 1:31am
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
Sat 26th May '01, 1:32am
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/showthread.php?s=&postid=114250#post114250 :)
fastforward
Sat 26th May '01, 1:35am
Originally posted by eva2000
all fixed now above previous post http://vbulletin.com/forum/showthread.php?s=&postid=114250#post114250 :)
Yay... :D
Thanks mate.
I'll have to fix the docs and revert my templates tomorrow then.
eva2000
Sat 26th May '01, 1:49am
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
Sat 26th May '01, 1:53am
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
Sat 26th May '01, 1:57am
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
Sat 26th May '01, 2:06am
oh yeah another thing i;m using the Zend cache trial so with html pages they won't be cached right ?
fastforward
Sat 26th May '01, 2:08am
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
Sat 26th May '01, 2:10am
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
Sat 26th May '01, 3:51am
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
Sat 26th May '01, 1:50pm
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
Sun 27th May '01, 2:15pm
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
Mon 28th May '01, 3:54am
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
eva2000
Mon 28th May '01, 6:53am
woah i had to edit nearly all of my templates :eek:
first important one
do a search template for the forum action part
<form action="
and you'll have to change them all to
<form action="/
otherwise, posting, replying, logging in and out and any forms won't work in netscape :(
only images i couldn't find the link to edit to add $bburl/ to are
$post[foldericon]
and the only link i can't seem to find to add $bburl/ to is in forumdisplaybit
$thread[postedby]
where is this ?
fastforward
Mon 28th May '01, 1:48pm
I also had a problem with the bbcode smilies not showing up. I had to edit functions.php and add a slah before the href in this line:
$bbcode=str_replace(trim($smilie[smilietext]),"<img src=\"/$smilie[smiliepath]\" border=\"0\" alt=\"\">",$bbcode);
It's on or around line 362.
Not sure about the posted by link yet.
I wish I'd never thought of this hack now :(
eva2000
Tue 29th May '01, 10:52am
i fixed the smilies and posticon problem by adding a slash / in the edit smilies in the admin panel
also another problem
merging threads won't work with your shorter url :(
is it possible to show/display the real url in a small table on/under the thread or on the merge thread template
i.e. display something like please input the thread to merge in the format
http://animeboards.com/showthread.php?s=&threadid=XXXX
where XXXX corresponds to
http://animeboards.com/tXXXX/s.html
fastforward
Tue 29th May '01, 1:44pm
Originally posted by eva2000
i fixed the smilies and posticon problem by adding a slash / in the edit smilies in the admin panel
also another problem
merging threads won't work with your shorter url :(
is it possible to show/display the real url in a small table on/under the thread or on the merge thread template
i.e. display something like please input the thread to merge in the format
http://animeboards.com/showthread.php?s=&threadid=XXXX
where XXXX corresponds to
http://animeboards.com/tXXXX/s.html
What we need is a little link that can be displayed on every page that whne clicked, will reload whatever page you happen to on using the original url. It should be possible with a seperate php script. However, I gotta wonder if it's really worth the hassle. I might just give it up and just use Overgrow's hack.
There must be an easier way than this. I'm going to spend a few hours reading the Apache docs. I can't believe it needs to be this hard.
eva2000
Tue 29th May '01, 1:49pm
Originally posted by fastforward
What we need is a little link that can be displayed on every page that whne clicked, will reload whatever page you happen to on using the original url. It should be possible with a seperate php script. However, I gotta wonder if it's really worth the hassle. I might just give it up and just use Overgrow's hack.
There must be an easier way than this. I'm going to spend a few hours reading the Apache docs. I can't believe it needs to be this hard. well for what it's worth.. google.com bot paid my forums and visit and i can see it running all the way through my forums especially with overgrow's hack but yours as well :D
porfiry
Mon 16th Jul '01, 2:52am
I see that I'm digging up an old thread, but I have a solution to the problem discussed.
The answer is rewriting!
RewriteRule ^f([0-9]+)/s([^/]*)/$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^t([0-9]+)/s([^/]*)/thread\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^[ft]([0-9]+)/s([^/]*)/(.+)$ /$3 [L]
I've modified the first 2 rules a bit to make things easier. The 3rd rule simply changes any URL like "/f1/s1/newreply.php" that would normally cause a problem and just rewrites it to "/newreply.php". This should also work for any images. No need to muck with templates.
eva2000
Mon 16th Jul '01, 7:38am
Originally posted by porfiry
I see that I'm digging up an old thread, but I have a solution to the problem discussed.
The answer is rewriting!
RewriteRule ^f([0-9]+)/s([^/]*)/$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^t([0-9]+)/s([^/]*)/thread\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^[ft]([0-9]+)/s([^/]*)/(.+)$ /$3 [L]
I've modified the first 2 rules a bit to make things easier. The 3rd rule simply changes any URL like "/f1/s1/newreply.php" that sould normally cause a problem and just rewrites it to "/newreply.php". This should also work for any images. No need to muck with templates. where were you when i added this hack :)
what i did for my subsequent styles was create replacement variables for form and other urls and it works but i'll try your method when an upgrade to the next release might force me to revert too many templates :D
VirtueTech
Tue 17th Jul '01, 1:55pm
Eva check your PM's please
fastforward
Wed 18th Jul '01, 1:50pm
Like eva2000, I also solved it the hard way :(
Although the form problems were happening in both IE and Netscape, Netscape also had a lot of other problems with normal links. Does this method work with Netscape?
I'll try it when 2.02 is released :)
steven
Tue 24th Jul '01, 3:42pm
Originally posted by porfiry
I see that I'm digging up an old thread, but I have a solution to the problem discussed.
The answer is rewriting!
RewriteRule ^f([0-9]+)/s([^/]*)/$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^t([0-9]+)/s([^/]*)/thread\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^[ft]([0-9]+)/s([^/]*)/(.+)$ /$3 [L]
I've modified the first 2 rules a bit to make things easier. The 3rd rule simply changes any URL like "/f1/s1/newreply.php" that sould normally cause a problem and just rewrites it to "/newreply.php". This should also work for any images. No need to muck with templates.
Sorry to bring up an old thread again, but I would like to use this hack on my board and had a couple of questions. I was wondering how I would change the above code to reflect my forums directory which is not run as root, but is run as http://www.mydomain.com/forums
Any Help is greatly appreciated.
Steven
Thomas P
Sun 29th Jul '01, 10:03am
Originally posted by steven
I was wondering how I would change the above code to reflect my forums directory which is not run as root, but is run as http://www.mydomain.com/forums
Any Help is greatly appreciated.
Steven
http://www.vbulletin.com/forum/showthread.php?&postid=114210#post114210
Thomas P
Sun 29th Jul '01, 10:51am
Fantastic hack! But I have some problems:
Okay, a.m. fastforward's hint works for me,
but I have problems with rewriting in general as it seems.
This is my .htaccess on Apache 1.3.20 placed in the root dir.
RewriteEngine on
RewriteRule ^forum/f([0-9]+)/s([^/]*)/$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^forum/t([0-9]+)/s([^/]*)/thread\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^forum/[ft]([0-9]+)/s([^/]*)/(.+)$ /$3 [L]
# Testing
RewriteRule ^forum/foo/(.*)$ /bar/index.html [R]
Test:
http://mcseboard.de/forum/foo/
is rewritten to
http://mcseboard.de/bar/index.html
So, rewrites seem to work - just try the link.
But my board behaves as usual making no notice of the rules as it seems.
What's going wrong here?
Thanks for any hint,
-Tom
P.S.: I don't have access to httpd.conf or the RewriteLog if there is...
auto
Sun 29th Jul '01, 11:07am
This is what i have in my .htaccess in the root directory:
RewriteEngine on
RewriteRule ^vbulletin/f([0-9]+)/s([^/]*)/$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^vbulletin/t([0-9]+)/s([^/]*)/thread\.html$ /showthread.php?threadid=$1&s=$2 [L]
RewriteRule ^vbulletin/[ft]([0-9]+)/s([^/]*)/(.+)$ /$3 [L]
and the rule does not appear to work :(
My vB is here: http://www.automotiveforums.com/vbulletin/index.php
any help would be appreciated.
Thomas P
Sun 29th Jul '01, 11:18am
Hi,
does rewriting work in general?
Try to test it with something like
RewriteRule ^vbulletin/foo/(.*)$ /bar/index.html [R]
Enter http://yourdomain/vbulletin/foo/
Rewriting works for me in general, but the board doesn't seem
to be affected...
-Tom
auto
Sun 29th Jul '01, 4:12pm
RewriteRule ^vbulletin/foo/(.*)$ /index.php [R]
that works,
when you go to http://www.automotiveforums.com/vbulletin/foo/
it directs you to the index page.
Thomas P
Sun 29th Jul '01, 6:03pm
Then we seem to have the same problem... :(
auto
Sun 29th Jul '01, 7:52pm
Sure does look like it.
fastforward
Sun 29th Jul '01, 8:06pm
This may or may not help. It will probably confuse things even more :)
Here's what I have in my httpd.conf:
RewriteRule ^/f([0-9]+)/?$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^/t([0-9]+)\.html$ /showthread.php?threadid=$1 [L]
I dispensed with the session tag as it wasn't really helping the spiders becaue the number would change each time anyway. I also edited all my templates to sort out the drop-down problems (I did this before I read porfiry's post).
In your problem examples I notice you don't start the url with a slash. You might want to try that. You never know.
Thomas P
Mon 30th Jul '01, 6:19pm
Hi fastforward,
thanks for answering, I tried that, but it didn't seem to work :(
Are these the only two line regarding rewrite in your conf?
Where is the one which builds the /f1/... or /fx/...? :)
I really would like to sort it out since this is one of the most useful hack for vB ever - maybe even for php-based sites in general.
Thanks,
-Tom
eva2000
Mon 30th Jul '01, 7:02pm
Originally posted by fastforward
This may or may not help. It will probably confuse things even more :)
Here's what I have in my httpd.conf:
RewriteRule ^/f([0-9]+)/?$ /forumdisplay.php?forumid=$1&s=$2 [L]
RewriteRule ^/t([0-9]+)\.html$ /showthread.php?threadid=$1 [L]
I dispensed with the session tag as it wasn't really helping the spiders becaue the number would change each time anyway. I also edited all my templates to sort out the drop-down problems (I did this before I read porfiry's post).
In your problem examples I notice you don't start the url with a slash. You might want to try that. You never know.
what do i need to do to remove the session tag but still have this format
http://animeboards.com/f38/s
http://animeboards.com/t20418/s.html
?
currently i have in my httpd.conf
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]
RewriteRule ^/html/.* /html/index.php [L]
thanks :)
fastforward
Mon 30th Jul '01, 7:37pm
Gimme till tomorrow night and I'll redo the hack based on the 2.02 code and post full instructions. I'll use the 'double rewrite' method that porfiry contributed to avoid changing a bazillion templates :)
ThomasP: The /f12 bits are created by editing the templates. All the rewrite does is change those short urls back to something that the vB php code knows about.
Thomas P
Mon 30th Jul '01, 7:55pm
oops, my bad - I see.
Thanks for your help and take your time,
-Tom
auto
Mon 30th Jul '01, 10:20pm
I finally got it to work by taking out the extra "/" from the first 2 lines, wooohooo!!!:D
Now I face smaller, yet another problem.
Take this page for example:
http://www.automotiveforums.com/vbulletin/t4667.html
The 2nd page of the thread will not be indexed by search engines :(
How can I use mod_rewrite to make the 2nd page be
http://www.automotiveforums.com/vbulletin/t4667-2.html
3rd page: http://www.automotiveforums.com/vbulletin/t4667-3.html... etc?
Thanks for any help.
auto
Tue 31st Jul '01, 12:58pm
Well, I've done it!:D
http://www.automotiveforums.com/vbulletin/t4667.html
And click on page 2, 3, and 4 ;)
Thread [ << < 1 2 3 4 > >> ]
If there's anybody that wants the rewrite code for this I'll post it, it was easier than I thought, after twisting my head for 2 hours.
fastforward
Tue 31st Jul '01, 2:44pm
Originally posted by auto
Well, I've done it!:D
http://www.automotiveforums.com/vbulletin/t4667.html
And click on page 2, 3, and 4 ;)
Thread [ << < 1 2 3 4 > >> ]
If there's anybody that wants the rewrite code for this I'll post it, it was easier than I thought, after twisting my head for 2 hours.
You didn't tell us you were doing it! I spent hours last night doing this :D Actually, 2.0.2 made it a little easier due to the change in the pagenav handling.
Mine appears to be working on IE, but I haven't tried every possible scenario and I haven't tested it on Netscape. It handles multipage threads, but I still need to add support for multi-page threadlistings. Once complete, you should be able to block spiders from all dynamic urls and still have them index ALL posts.
If anyone wants to help debug it, here it is:
----------------------------------------------
1) Edit /etc/httpd.conf
httpd.conf needs editing to enable and configure mod_rewrite. Here's all the relevent bits from my httpd.conf. It can go anywhere between the <VirtualHost> & </VirtualHost> tags.
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]
2) Edit Templates
a. The following templates contain the forum links that need changing (one occurance in each)
-> forumdisplay_forumbit_level1_nopost
-> forumdisplay_forumbit_level1_post
-> forumdisplay_forumbit_level2_nopost
-> forumdisplay_forumbit_level2_post
-> forumhome_forumbit_level1_nopost
-> forumhome_forumbit_level1_post
-> forumhome_forumbit_level2_nopost
-> forumhome_forumbit_level2_post
The new link should be: <a href="$bburl/f$forum[forumid]/">$forum[title]</a>
b. The following template contains the thread link that needs changing:
-> forumdisplaybit
The new link should be: <a href="$bburl/t$thread[threadid].html">$thread[title]</a>
c. The following templates contain the pagenav bits:
-> forumdisplay_multipagenav_pagenumber
Replace the link within this templatewith:
$bburl/t$thread[threadid]-$acurpage.html
--------------------------------------------------------------
auto
Tue 31st Jul '01, 5:55pm
This is what I added for the thread#-page#.html to work:
RewriteRule ^t([0-9]+)-([0-9]+)\.html$ showthread.php?threadid=$1&perpage=10&pagenumber=$2 [L]
Then I had to modify functions.php
You can find what to modify by finding the veriables that correspond to the page nav in the templates.
Thomas P
Sun 9th Sep '01, 1:07pm
Has anyone managed to get that working via .htaccess?
If mod_rewrite is enabled it works as well via .htaccess - right?
At least that works on my account:
RewriteEngine on
RewriteBase /test/
RewriteRule ^(.+) http://www.mcseboard.de/$1 [R,L]
thx,
-Tom
steven
Tue 11th Sep '01, 4:33am
Originally posted by Thomas P
Has anyone managed to get that working via .htaccess?
If mod_rewrite is enabled it works as well via .htaccess - right?
At least that works on my account:
RewriteEngine on
RewriteBase /test/
RewriteRule ^(.+) http://www.mcseboard.de/$1 [R,L]
thx,
-Tom
I would also like to know if anyone has managed to do this via .htaccess?
TheComputerGuy
Wed 19th Sep '01, 10:38pm
where can I find the htaccess that you speak of, I mean I looked all over my account and could not find it...
Thomas P
Thu 20th Sep '01, 5:13am
Just create one...
GameCrash
Thu 20th Sep '01, 12:47pm
Originally posted by TheComputerGuy
where can I find the htaccess
Don't forget the dot... it must be called .htaccess :)
Thomas P
Fri 21st Sep '01, 5:40am
Hi GameCrash!
have you tried that hack on d)f?
Btw: I'm with d)f now, too. Great support and nice features.
cu,
-Tom
GameCrash
Fri 21st Sep '01, 5:47am
Sorry, D)F does not support mod_rewrite. So if you try to turn the RewriteEngine to on you will get an error 500, sorry ;)
Thomas P
Fri 21st Sep '01, 8:55am
Originally posted by GameCrash
Sorry, D)F does not support mod_rewrite. So if you try to turn the RewriteEngine to on you will get an error 500, sorry ;)
I have the answer from d)f support that mod_rewrite is enabled.
The following works for example:
RewriteEngine on
RewriteBase /test/
RewriteRule ^(.+) http://www.mcseboard.de/$1 [R,L]
create a directory named "test" and put the above into an .htaccess into the dir. test to try that - it works!
But not all from fastforwards samples, so that's why I wonder... :confused:
-Tom
GameCrash
Fri 21st Sep '01, 9:34am
Well... maybe they have enabled it now as so many people have asked for it - the last time I asked they said it's disabled...
Thomas P
Fri 21st Sep '01, 10:44am
I see, yeah could be...
Still couldn't get it working properly.
Do you have any plans to try that?
I'll play around the next days with it.
cu,
-Tom
GameCrash
Fri 21st Sep '01, 10:57am
No, I won't as I will change my hoster the next days (I hope). I will go to a gamesite hoster - it's cheaper for me ;)
Thomas P
Fri 21st Sep '01, 12:15pm
May I ask which one?
GameCrash
Fri 21st Sep '01, 12:22pm
No :D
And I don't think we should discuss this in this thread any more ;)
steven
Fri 28th Sep '01, 4:08pm
So does anyone have a final version of this hack, as I would really like to use it on my site via an .htaccess file.
Haakon
Thu 4th Oct '01, 8:50am
Hello, has anyone else got problems with downloading the hack? My Gozilla only tries to download attachments.php which is 0kb :confused:
RobAC
Thu 4th Oct '01, 11:12am
Probably a stupid question, but where do you find the httpd.conf file? It's not listed in my directory that I can find. Is this hack something that will work on a hosted server?
Raz Meister
Thu 4th Oct '01, 7:52pm
If you're on a shared server then just put the commands in a .htaccess file.
RobAC
Thu 4th Oct '01, 8:09pm
Where should the .htaccess file go? Forums directory?
Raz Meister
Sat 6th Oct '01, 8:53am
Yes
CoolaShacka
Sat 6th Oct '01, 11:06am
Amazing Release. :eek:
Could pls. somebody post the endversion of it.
I've tryed a little bit arround, but is don't work for me.
Thank you in advance. :)
RobAC
Sat 6th Oct '01, 1:23pm
How does this hack handle private forums?
CoolaShacka
Sat 6th Oct '01, 1:30pm
@RobAC:
The Spiders are not registered on your Forums, ans they don't have the necessary permissons. They can not spider inside your private Forums. They can only spider in your public forums.
PS. I'm still waiting for the final release of this hack.
RobAC
Sat 6th Oct '01, 1:37pm
I don't have a full understanding of how the overall permissions would work as it relates to search engine spiders etc.
I understand that the spiders are not "registered" on the forums, but if they "spider" the threads/forums, what is to prevent them from spidering the threads in a private forum?
Haakon
Sat 6th Oct '01, 2:52pm
RobAc: The spiders visits the pages just the way we do. If we click the link to the private forum, then we will be presented with a password verification form; we don`t know it so we leave. This is the same with robots/spiders, they leave when they can`t go any further.
Raz Meister
Sat 6th Oct '01, 10:05pm
Also if you've set "Hide Private Forums" they won't even get the forums permission page as they won't even be able to see the forum!
Think of a web crawler as a Guest visitor.
Byron
Sat 20th Oct '01, 12:45pm
I have the following in my .htaccess
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]
Kept getting 500 errors or 404 errors.
Are there any other commands which I need to include in the .htaccess?
Thanks
Byron
Sun 21st Oct '01, 5:33am
anyone got this hack working via .htaccess?
steven
Sun 21st Oct '01, 6:09am
well thanks to auto, I got this working. Anyways I have my forums setup like www.mydomain.com/forums so the following is my .htaccess file
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]
Byron
Sun 21st Oct '01, 8:47am
Thanks steven.
Your .htaccess works. No more 500 or 404 errors now. But I noticed that your thread url is in the format of
http://domain.com/forums/t100.html
My thread url is in the format of
http://domain.com/forums/t100/s.html
and it leads to a 404 page as i am using fastforward's hack instructions for step 2 and 3.
May i know what did you use to replace (step 2 & 3)
<a href="$bburl/f$forum[forumid]/s$session[sessionhash]">$forum[title]</a>
<a href="$bburl/t$thread[threadid]/s$session[sessionhash].html">$thread[title]</a>
Thanks a lot.
Byron
steven
Sun 21st Oct '01, 6:28pm
byron I PM'd you.
Byron
Sun 21st Oct '01, 10:52pm
* Byron walking up to the podium. *
Firstly I would like to thank Fastforward for writing this and thanks to steven and auto for the .htaccess.
* Speech end. *
Feedback to those using the .htaccess method.
I have got it running by removing the "s$session[sessionhash]" part in step 2 & 3, using hard coded url for all instances of $bburl and using the the following in my .htaccess.
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]
Step 2 & 3
<a href="$bburl/f$forum[forumid]/">$forum[title]</a>
<a href="$bburl/t$thread[threadid].html">$thread[title]</a>
That's all.
Wait. That's not the end. Need to confirm.
To Fastforward and the rest : Did i miss out anything by using the above .htaccess and removing the "s$session[sessionhash]" in step 2 &3?
Thanks. Cheers to vB. :)
Byron
Cyrus
Mon 22nd Oct '01, 6:08am
i dont get it
i downloaded the install txt
what the hell is httpd.conf ? :)
and I dont get any of the other instructions either
can someone make a dummys guide of it for me ??
thank you
Haakon
Tue 30th Oct '01, 8:19am
I`ve implemented the hack temporarily through .htaccess , and it seems to works great. Especially seeing that PR* only drops one level from inedex to any thread. Currently it drops two from index to category, but this is unnecessary, and can be fixed by just deleting this slash:
<a href="$bburl/f$forum[forumid]/">$forum[title]</a>
<a href="$bburl/f$forum[forumid]">$forum[title]</a>
One thing I would really like to see implememnted into the hack, is the code for rewriting the path to the next pages of threads listed, like
"Pages (3): [ 1 2 3 > "
would get SE friendly. The current code is quite wast and it`s dynamic so I don`t know if it`s possible, is it?
Like
http://www.radiomute.com/forumdisplay.php?s=&forumid=26&daysprune=1000&sortorder=&sortfield=lastpost&perpage=25&pagenumber=2
could be transformed into http://www.radiomute.com/f261000252 ?
Then all threads would be crawled :D
*PR= Page Rank, used by google as the main meassure of page importance. The higher, the better!
DoST
Tue 30th Oct '01, 9:35am
I read the whole thread from the beginning and I'm confused now. I really want to install this hack, but everyone is saying something different. What is the easiest way to implement this hack? I can do it via httpd.conf. I'd really appreciate it if someone could post the final instructions.
Thanks
Powered by vBulletin™ Version 4.0.0 Beta 4 Copyright © 2009 vBulletin Solutions, Inc. All rights