This is a very quick 'n' simple vBulletin SEO hack. It's easy to apply and it's the one I have been using here on DaniWeb for the past couple of months. I was going to wait until we went vB 3.5 to release it but I might as well do so now ... Disclaimer: This is for vBulletin 3.0.x. It should not be too complicated to port to 3.5 with their hooks system, but I have no experience with 3.5 and therefore don't want to say one way or another. If you use this hack, please link to DaniWeb in your footer. This is a free hack, and it can make or break the traffic to your site. I don't know of any other freely available hacks like this one. Please help us out in exchange for releasing this!

STEP 1: Create an .htaccess file in your forum directory and put the following into it:

Options +FollowSymLinks
RewriteEngine on
RewriteRule ^getdaily.html$ search.php?do=getdaily [L]
RewriteRule ^getdaily([0-9]+).html$ search.php?do=getdaily&f=$1 [L]
RewriteRule ^unanswered.html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1     [L]
RewriteRule ^unanswered([0-9]+).html$ search.php?do=process&replyless=1&replylimit=0&dontcache=1&forumchoice=$1&childforums=1 [L]
RewriteRule ^forum([0-9]+).html$        forumdisplay.php?f=$1         [L]
RewriteRule ^forum([0-9]+)-([0-9]+)-([a-z]+)-(.*)-([0-9]+)-(.*).html$ forumdisplay.php?f=$1&page=$2&sort=$3&order=$4&pp=$5&daysprune=$6 [L]
RewriteRule ^forum([0-9]+)-(.*)-([a-z]+)-([a-z]+).html$    forumdisplay.php?f=$1&daysprune=$2&order=$3&sort=$4     [L]
RewriteRule ^announcement([0-9]+).html$     announcement.php?f=$1     [L]
RewriteRule ^announcement([0-9]+)-([0-9]+).html$    announcement.php?f=$1&announcementid=$2 [L]
RewriteRule ^thread([0-9]+).html$     showthread.php?t=$1     [L]
RewriteRule ^thread([0-9]+)-([0-9]+).html$    showthread.php?t=$1&page=$2     [L]
RewriteRule ^getnew.html$ search.php?do=getnew [L]
RewriteRule ^getnew([0-9]+).html$ search.php?do=getnew&f=$1 [L]
RewriteRule ^printthread([0-9]+).html$    printthread.php?t=$1     [L]
RewriteRule ^sendthread([0-9]+).html$    sendmessage.php?do=sendtofriend&t=$1 [L]
RewriteRule ^referthread([0-9]+)-([0-9]+).html$ showthread.php?t=$1&referrerid=$2    [L]
RewriteRule ^lastpostinthread([0-9]+).html$ showthread.php?goto=lastpost&t=$1 [L]
RewriteRule ^newpostinthread([0-9]+).html$ showthread.php?goto=newpost&t=$1 [L]
RewriteRule ^nextnewesttothread([0-9]+).html$    showthread.php?t=$1&goto=nextnewest    [L]
RewriteRule ^nextoldesttothread([0-9]+).html$    showthread.php?t=$1&goto=nextoldest    [L]
RewriteRule ^post([0-9]+).html$     showthread.php?p=$1     [L]
RewriteRule ^post([0-9]+)-([0-9]+).html$    showpost.php?p=$1&postcount=$2    [L]
RewriteRule ^post([0-9]+)-([0-9]+)-([0-9]+).html$ showthread.php?p=$1&page=$2&pp=$3    [L]
RewriteRule ^thread([0-9]+)-([a-z]+).html$ showthread.php?mode=$2&t=$1    [L]
RewriteRule ^post([0-9]+)-([a-z]+).html$ showthread.php?p=$1&mode=$2    [L]

STEP 2:

In the includes/functions.php file, below

function print_output($vartext, $sendheader = 1)
{
global $pagestarttime, $query_count, $querytime, $DB_site, $bbuserinfo;
global $vbphrase, $vboptions, $stylevar, $_REQUEST;

in 3.0.7 (in another version of 3.0.x, just put the code below the global declarations in the print_output function) add:

// do Dani's SEO optimization
global $session;
 
$search_array = array(
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;order="). '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;daysprune="). '([^"]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"^&]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune="). '([^"^&]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]*)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=lastpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=newpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"printthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"sendmessage.php?$session[sessionurl]do=sendtofriend&amp;t=") . '([0-9]+)"#', 
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;goto=next"). '([a-z]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showpost.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;postcount=") . '([0-9]+)"#', 
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]mode=") . '([a-z]+)' . preg_quote("&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;mode=") . '([a-z]+)\##', 
 
'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;announcementid=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)"#',
 
// sanitizing
'#<a ([^>]*)href\=\"([^"]*)&amp;page=([^"]*).html"#',
'#<a ([^>]*)href\=\"([^"]*)&amp;highlight=([^"]*).html"#',
 
// other
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily&amp;f=") . '([0-9]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=&amp;childforums=1") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=") . '([0-9]+)' . preg_quote("&amp;childforums=1") . '"#'
 
);
$replace_array = array(
'<a \1href="forum\2-\3-\4-\5-\6-\7.html"',
'<a \1href="forum\2-\7-\5-\4-\6-\3.html"',
'<a \1href="forum\2-\3-\4-\5.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2.html"',
'<a \1href="lastpostinthread\2.html"',
'<a \1href="newpostinthread\2.html"',
'<a \1href="printthread\2.html"',
'<a \1href="sendthread\2.html"',
'<a \1href="next\3tothread\2.html"', 
'<a \1href="post\2.html"', 
'<a \1href="post\2-\3-\4.html"', 
'<a \1href="post\2-\3.html"', 
'<a \1href="thread\3-\2.html"', 
'<a \1href="post\2-\3.html#', 
 
'<a \1href="announcement\2-\3.html"',
'<a \1href="announcement\2.html"',
 
// sanitizing
'<a \1href="\2-\3.html"',
'<a \1href="\2-\3.html"',
 
// other
'<a \1href="getdaily\2.html"',
'<a \1href="getdaily.html"',
'<a \1href="unanswered.html"',
'<a \1href="unanswered\2.html"'
 
);
$vartext = preg_replace($search_array, $replace_array, $vartext);

Please do not duplicate all or part of this code elsewhere. Thanks should go out to Xenon for suggesting to me that I can rewrite URLs from within this function. Thanks!! ... And, please, give credit where credit is due - if you use this hack, please link back.

Verynice Hack and is there any chanse we can get this work like the VBSeo from vbseo.com ?

Update:

I just took a look at vB 3.5. Based on what I can see - and this still goes untested - add the .htaccess file as mentioned above. Then, throw all the PHP code into the global_complete hook. The only difference to make is the last line should read:

$output = preg_replace($search_array, $replace_array, $output);

We're doing a find/replace on the parsed $output instead of the raw $vartext because, quite simply, a hook doesn't exist earlier in the function. So hopefully it will work.


If for whatever reason that above hook doesn't work, the fail-safe way that will 100% work in vB 3.5 is to add the exact code as in the original tutorial below:

function print_output($vartext, $sendheader = true)
{
global $pagestarttime, $querytime, $vbulletin;
global $vbphrase, $stylevar;

Verynice Hack and is there any chanse we can get this work like the VBSeo from vbseo.com ?

Using directories can be accomplished by simply replacing the .html postfix areas of the code with the / prefix as necessary.

I haven't investigated the code close enough to know whether this function has access to the $thread['title'] variable ... I assume that it does, and if so, you can simply use it in the PHP code, but it remains untested.

This hack has been tested to have no problems on both a vB 3.0.7 installation as well as a vB 3.5 installation - both by editing the functions.php file as mentioned above. It has not yet been tested using the 3.5 hooks method.

Which version are you working with?

This hack has been tested to have no problems on both a vB 3.0.7 installation as well as a vB 3.5 installation - both by editing the functions.php file as mentioned above. It has not yet been tested using the 3.5 hooks method.

Which version are you working with?

It is for version 3.0.3.
I may have edited a few templates from the previous mod_rewrite hack so I'll get on this later this week and see where the problem lies. Thanks.

Yes, that seems like it's almost definitely the problem. :)

I've reverted the templates and files to the default stage. And whala~ everything is good to go.


Except two things:

1) New post links in the forumhome goes to the .php page rather than .html.
e.g. http://www.daniweb.com/techtalkforums/newpostinthread2379.html link takes you to http://www.daniweb.com/techtalkforums/showthread.php?p=14318#post14318

2) In the online.php? page, if the visitor (a google bot) is looking at a specific posts in a thread, e.g. http://www.daniweb.com/techtalkforums/showthread.php?p=8308#postid=8308
it shows up as a .php? rather than a .html

but all other threads show up properly as .html. So only when a member or a visitor is at a specific post, the link in the online.php? page shows up in such a way.

My hack only alters URLs in templates, not URLs that were generated in the php files themselves. If you want to fix problem #1 you illustrated, you would have to start editing PHP files. It's a trade off whether you want to be 100% SEO'ed or whether you want the hack to be self-contained. For me, I don't care about it redirecting to the non-SEO'd version as long as the spiders get a taste of newpostinthread.html and lastpostinthread.html

To answer your second question, I didn't bother SEO'ing this because spiders never see the online.php page, it should be set to members-only access.

That makes clear sense. Thank you.

It's supposed to be lastpostinthread, not lastposttothread. DaniWeb doesn't seem to be experiencing this problem? Can you confirm that DaniWeb has the same bug? I'm not sure why it's doing what it's doing, but this should eliminate the problem:

To fix it, in functions.php:

Replace

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;goto="). '([a-z]+)"#',

with

'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;goto=next"). '([a-z]+)"#',

Also, replace

'<a \1href="\3tothread\2.html"',

with

'<a \1href="next\3tothread\2.html"',

I have edited the first post to reflect this change.

Great thread. Has 3.5.1 been confirmed to work with this? (vs. 3.5) :?:

The hack works fine, yet would it be possible to change to ‘forum1 and post1’ into ‘forum title and post title’?

Thanks.

We wanted to make sure that we understand how to correctly install this hack in 3.5.1 before we blow something up :mrgreen:

First we make the .htaccess file, and then we find this code in the includes/functions.php file:

function print_output($vartext, $sendheader = true)
{
global $pagestarttime, $querytime, $vbulletin;
global $vbphrase, $stylevar;

and then we add this below it:

// do Dani's SEO optimization
global $session;

$search_array = array(
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;order="). '([a-z]*)' . preg_quote("&amp;pp=") . '([0-9]*)' . preg_quote("&amp;daysprune="). '([^"]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"^&]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune="). '([^"^&]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]*)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=lastpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]goto=newpost&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"printthread.php?$session[sessionurl]t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"sendmessage.php?$session[sessionurl]do=sendtofriend&amp;t=") . '([0-9]+)"#', 
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]t=") . '([0-9]+)' . preg_quote("&amp;goto=next"). '([a-z]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;pp=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showpost.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;postcount=") . '([0-9]+)"#', 
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]mode=") . '([a-z]+)' . preg_quote("&amp;t=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"showthread.php?$session[sessionurl]p=") . '([0-9]+)' . preg_quote("&amp;mode=") . '([a-z]+)\##', 

'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;announcementid=") . '([0-9]+)"#',
'#<a ([^>]*)href' . preg_quote("=\"announcement.php?$session[sessionurl]f=") . '([0-9]+)"#',

// sanitizing
'#<a ([^>]*)href\=\"([^"]*)&amp;page=([^"]*).html"#',
'#<a ([^>]*)href\=\"([^"]*)&amp;highlight=([^"]*).html"#',

// other
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily&amp;f=") . '([0-9]*)"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=getdaily") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=&amp;childforums=1") . '"#',
'#<a ([^>]*)href' . preg_quote("=\"search.php?$session[sessionurl]do=process&amp;replyless=1&amp;replylimit=0&amp;dontcache=1&amp;forumchoice=") . '([0-9]+)' . preg_quote("&amp;childforums=1") . '"#'

);
$replace_array = array(
'<a \1href="forum\2-\3-\4-\5-\6-\7.html"',
'<a \1href="forum\2-\3-\4-\5.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2-\3.html"',
'<a \1href="forum\2.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2-\3.html"',
'<a \1href="thread\2.html"',
'<a \1href="lastpostinthread\2.html"',
'<a \1href="newpostinthread\2.html"',
'<a \1href="printthread\2.html"',
'<a \1href="sendthread\2.html"',
'<a \1href="next\3tothread\2.html"', 
'<a \1href="post\2.html"', 
'<a \1href="post\2-\3-\4.html"', 
'<a \1href="post\2-\3.html"', 
'<a \1href="thread\3-\2.html"', 
'<a \1href="post\2-\3.html#', 

'<a \1href="announcement\2-\3.html"',
'<a \1href="announcement\2.html"',

// sanitizing
'<a \1href="\2-\3.html"',
'<a \1href="\2-\3.html"',

// other
'<a \1href="getdaily\2.html"',
'<a \1href="getdaily.html"',
'<a \1href="unanswered.html"',
'<a \1href="unanswered\2.html"'

);
$vartext = preg_replace($search_array, $replace_array, $vartext);

Is that correct :?:

Thank you.

Yes. Doing is that way is guaranteed to work.

The second way is to use hooks, but no one has yet confirmed that my hooks method works.

DaniWeb website works smoothly. The code you've provided, I could not find it on functions.php file for version 3.0.3.

Hmm... :confused:

It's supposed to be lastpostinthread, not lastposttothread. DaniWeb doesn't seem to be experiencing this problem? Can you confirm that DaniWeb has the same bug?

Kwak,

The lines that I asked you to replace (in post #13) to fix the lastpostinthread bug are located within the code that you were supposed to add to functions.php in the original tutorial. They aren't naturally in functions.php

Thanks once again. The last page link works (not in .html) perfectly.

Your first question was answered in post #10 of this thread.

A hooks version of my hack is available in post #3. It should work, but remains untested.

Any idea how to change the "forum number" by "forum title"? :?:

The hack works fine, yet would it be possible to change to ‘forum1 and post1’ into ‘forum title and post title’?

Thanks.

A bug on test VB3.5.1 forum (hook system works find): on a page like forum90.html in the navbar I get forumdisplay.php?f=90&page=6&order=desc and not something like forum8-4-lastpost--40--1.html. Hope this helps !

Ok tks dani ; another "bug" on your forum :

on this page http://www.daniweb.com/techtalkforums/forum90--1-desc-views.html if I click on the arrow to order asc I get this url : http://www.daniweb.com/techtalkforums/forumdisplay.php?f=90&daysprune=-1&order=asc&sort=views&pp=40&page=1.

To fix this:

Below

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;page=") . '([0-9]+)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;pp=") .  '([0-9]*)' . preg_quote("&amp;daysprune=") . '([^"]*)"#',

add

'#<a ([^>]*)href' . preg_quote("=\"forumdisplay.php?$session[sessionurl]f=") . '([0-9]+)' . preg_quote("&amp;daysprune=") . '([^"]*)' . preg_quote("&amp;order=") . '([a-z]*)' . preg_quote("&amp;sort=") . '([a-z]*)' . preg_quote("&amp;pp=") .  '([0-9]*)' . preg_quote("&amp;page=") . '([0-9]+)"#',

and below

'<a \1href="forum\2-\3-\4-\5-\6-\7.html"',

add

'<a \1href="forum\2-\7-\5-\4-\6-\3.html"',

I am going to update the original post to reflect this change.

Not by making any easy changes to the current hack. The reason is because it simply parses entire templates - and has no access to $thread[].

I get a 500 internal server error and in access log I read this:

[Fri Dec 9 16:16:00 2005] [alert] [client 81.196.xx.xx] /home/xxxxxxx/public_html/forum/.htaccess: RewriteRule: bad argument line '^nextnewesttothread([0-9]+).html$showthread.php?t=$1&goto=nextnewest[L]'\n

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.