vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.5 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=113)
-   -   vRewrite - SEOed URLs for vBulletin (https://vborg.vbsupport.ru/showthread.php?t=104484)

Immortal 02-14-2006 06:20 PM

The fix should've worked. If you wait just a wee bit longer, 1.0 stable will be released.

trilljester 02-14-2006 06:26 PM

yayvb: Try moving this rule:

RewriteRule ^(.*)-(.*)-(.*).html showthread.php?goto=$3&t=$2 [L]

to the bottom (before the vbseo stuff), and see what happens.

yayvb 02-14-2006 07:56 PM

I tried a bunch of things. I guess it's not the .hataccess file, I believe the problem lies in this code:
Code:

/*
#------------------------------
# SHOWTHREAD and page
#------------------------------
$found = preg_match_all('#showthread\.php\?t=([0-9]+)&page=([0-9]+)#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    // Keep track of page nums that go with tid's
    $temp = array();

    for($i = 0; $i < $found; $i++)
    {
        // $temp[<threadid>] = <page>
        $temp[ $matches[1][$i] ] = $matches[2][$i];

        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " . TABLE_PREFIX . "thread WHERE threadid IN($ids)");

    while($t = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($t['title']);
        $tid = $t['threadid'];
        $fid = $t['forumid'];
        $foruminfo = $vbulletin->db->query_first("SELECT title FROM " . TABLE_PREFIX . "forum WHERE forumid='$fid'");
        $fname = urlize($foruminfo['title']);
        $page = $temp[$tid];
       

        $output = str_replace("showthread.php?t=$tid&amp;page=$page", "$fname/t-$title-$tid-page-$page.html", $output);


    }

*/


}

I tried making small changes and retrying thinking that'll help, but no matter what I do page number links aren't being changed. It's a simple program I imagine, something looks for the URL and rewrites it. Then when you click on the rewritten URLS the .htaccess file redirects you to the RIGHT place if I'm not mistaken.

So if my urls aren't being rewritten then that must mean it's not the .htaccess file right? I will definitely wait for the stable version, I hope it's soon!!! Thanks again.

*EDIT*
I think I found the reason for the problem. It appears that the above code that is in question has comment tags before and after basically commenting all of this code!!! If I take out the 2 comment codes around this code I posted then I get a parse error grrr. The parse error I get after removing the comments codes is: Parse error: parse error, unexpected $ in /home/youradul/public_html/420boards/includes/functions.php(4314) : eval()'d code on line 646

Line 4314 of functions.php appears to be the global_complete hook, so obviously the code that was commented out that I pasted above is erroneous?

robertorg 02-16-2006 10:45 PM

It's possible to apply that modification to VBAdvanced??
Is recomended any robots.txt?

Good Work!!!! (It's installed, the only issue is VBAdvanced support)

Immortal 02-16-2006 11:15 PM

I posted a tutorial wayyyy back when. You may want to search the thread for "tutorial" and see if anything bites. It was for custom written rules, I haven't had a chance to play with vBA to see how it does it however. May require some plugin/file changes.

As far as robots.txt is concerned, I'm by far no SEO expert.

/me pokes T2DMan

DavidWilson 02-17-2006 12:56 AM

Hi, I've looked at the examples and downloaded the code; very easy install compared to Dan's.

One question I have in the installation is the follow:

As per step #3, I can't find the variable $headinclude in the following files:

showthread.php, newreply.php, newthread.php, forumdisplay.php, memberinfo.php

Smiry Kin's 02-17-2006 01:00 AM

Quote:

Originally Posted by DavidWilson
Hi, I've looked at the examples and downloaded the code; very easy install compared to Dan's.

One question I have in the installation is the follow:

As per step #3, I can't find the variable $headinclude in the following files:

showthread.php, newreply.php, newthread.php, forumdisplay.php, memberinfo.php

i think it means the templates?

Immortal 02-17-2006 01:07 AM

Yup, Styles & Templates, no file modifications needed :)

DavidWilson 02-17-2006 03:12 AM

Yes, for those of you that don't know, the default template file is located here: /install/vbulletin-style.xml

Custom template files are also *.xml and can be uploaded and imported over existing templates.

PGP 02-17-2006 04:23 AM

Immortal, why not just invoke <base href="$vboptions[bburl]/" /> into the top of the headinclude tempate? IMHO, it's more easier and faster? Am I right?

Brandon Sheley 02-17-2006 07:19 AM

Quote:

Originally Posted by Immortal
The fix should've worked. If you wait just a wee bit longer, 1.0 stable will be released.


yeah ! :D
btw, just updated and the problem i was having with long thread and pages appear to be gone, will be running it for the weekend :)

DavidWilson 02-17-2006 01:04 PM

I installed the script without any issues at first, but I did run into some linking problems on sub forum pages; the breadcrumb links didn't link far enough back in the directory tree structure, usually falling 1 directory shy, therefor there were quite a few broken links through the forum.

I've removed the extension for now, but I'm definitely looking forward to the final version!

Zia 02-18-2006 06:57 AM

ah..long thread...tried to read every single post here..
i had a bitter xeperince

we tried vbranking..we gave up due to probs...it automergerd post..AUTOMATICALLY after a new post or thread.

we droped dean c's re-writer..

yet not use it....found lots using it..n all pobs been solved..

i m curious about Googe/Yahoo sitemap gen....that sitemap generator geneate sitemap ...

hence thie re-writer re-write url to html? does that creates any conflicts?

:S here lots of modicication....
does the current one is complete package?

icare 02-18-2006 06:26 PM

Quote:

1) Import product-vrewrite.xml as a product using the plugin system.
2) Upload the .htaccess file to your vB's directory.

Can i just over rite the existing .htaccess file in root with the one you provided with zip file or what should i do. i am bit scared at this part coz i have heard that if you lose your .htaccess file you are hooped. please help a newbie

Immortal 02-19-2006 12:08 AM

Quote:

Originally Posted by PGP
Immortal, why not just invoke <base href="$vboptions[bburl]/" /> into the top of the headinclude tempate? IMHO, it's more easier and faster? Am I right?

Good thinking, never even dawned on me, heh.

Quote:

Originally Posted by DavidWilson
I installed the script without any issues at first, but I did run into some linking problems on sub forum pages; the breadcrumb links didn't link far enough back in the directory tree structure, usually falling 1 directory shy, therefor there were quite a few broken links through the forum.

I've removed the extension for now, but I'm definitely looking forward to the final version!

Sounds like you didnt' apply all template changes.

Quote:

Originally Posted by Zia
ah..long thread...tried to read every single post here..
i had a bitter xeperince

we tried vbranking..we gave up due to probs...it automergerd post..AUTOMATICALLY after a new post or thread.

we droped dean c's re-writer..

yet not use it....found lots using it..n all pobs been solved..

i m curious about Googe/Yahoo sitemap gen....that sitemap generator geneate sitemap ...

hence thie re-writer re-write url to html? does that creates any conflicts?

:S here lots of modicication....
does the current one is complete package?

A sitemap for vRewrite will be released shortly. You must apply all fixes yourself, until I can be arsed to release 1.0.


Quote:

Originally Posted by icare
Can i just over rite the existing .htaccess file in root with the one you provided with zip file or what should i do. i am bit scared at this part coz i have heard that if you lose your .htaccess file you are hooped. please help a newbie

Could you please post your current .htaccess?

Zia 02-19-2006 02:41 AM

Quote:

Originally Posted by Immortal
A sitemap for vRewrite will be released shortly. You must apply all fixes yourself, until I can be arsed to release 1.0.

Its nice.Better we wait few days..coz that lotta modification in all this long thread..might messed up..

Regarding Sitemap:

1. Google/Yahoo Sitemap :it creates .xml sitemap that exclusively for Google.
We are using it right now. & it points to *.php Url.

2. RoR Sitemap:It generate .xml sitemap ,its for some common search engine that usually used by www.addme.com 's SE. & Sitemap www.rorweb.com .

here no relation with Google sitemap & ror sitemap.

3.vRewrite[future plan] : Site Map also generate .xml sitemap ,maybe not for google. But as a common

Actaully want to know does the sitemaps(.php) url & re-written (.html)url ,any possibility to conflict like : spider looks for *.php (porbably) urls ,but its find *.html(static) url ?

as we are pissed of on deanc/vbranking...so b4 using it we are a bit in tense.

Hope This vRe-write & Sitemap would be a complete package..for most of the SE.


immortal..in the vb there are no release with a complete system for SEO.
i hope this sitemap will support cornjob.

And Plz Relaese It as early as possible.

sysop2 02-19-2006 10:12 AM

Hi, its me again.
I saw "last update: 17. February 2006", so i downloaded it again.
But its all the same as at the point i tried it the 1st time. Also the last update on the files in the .zip is 13th of January 2006.
Do i need to read every single post in this thread and apply additional changes which arent in the readme-file to let it work as it should? Or should it work if I simply follow the steps in the readme?

Greetz - ~sysop2~

Immortal 02-19-2006 01:55 PM

Quote:

Originally Posted by Zia
Its nice.Better we wait few days..coz that lotta modification in all this long thread..might messed up..

Regarding Sitemap:

1. Google/Yahoo Sitemap :it creates .xml sitemap that exclusively for Google.
We are using it right now. & it points to *.php Url.

2. RoR Sitemap:It generate .xml sitemap ,its for some common search engine that usually used by www.addme.com 's SE. & Sitemap www.rorweb.com .

here no relation with Google sitemap & ror sitemap.

3.vRewrite[future plan] : Site Map also generate .xml sitemap ,maybe not for google. But as a common

Actaully want to know does the sitemaps(.php) url & re-written (.html)url ,any possibility to conflict like : spider looks for *.php (porbably) urls ,but its find *.html(static) url ?

as we are pissed of on deanc/vbranking...so b4 using it we are a bit in tense.

Hope This vRe-write & Sitemap would be a complete package..for most of the SE.


immortal..in the vb there are no release with a complete system for SEO.
i hope this sitemap will support cornjob.

And Plz Relaese It as early as possible.

I am not releasing the sitemap, someone is releasing it as an extension to their current one.

Quote:

Originally Posted by sysop2
Hi, its me again.
I saw "last update: 17. February 2006", so i downloaded it again.
But its all the same as at the point i tried it the 1st time. Also the last update on the files in the .zip is 13th of January 2006.
Do i need to read every single post in this thread and apply additional changes which arent in the readme-file to let it work as it should? Or should it work if I simply follow the steps in the readme?

Follow the steps in the readme, and if you look a few pages back, there are two changes you need to apply. vRewrite 1.0 will be released this evening.

As far as the "update" is, there was none. I simply added some legal text to the bottom to prevent users from disturbing vRewrite.

sysop2 02-19-2006 03:06 PM

Quote:

Originally Posted by Immortal
As far as the "update" is, there was none. I simply added some legal text to the bottom to prevent users from disturbing vRewrite.

Ah, thanks for the Info :)
Looking forward to try out the full 1.0-Release later. But Im not euphoric this time. ;-D
Thank you for all the effort.

Greetz - ~sysop2~

Shoemoney 02-19-2006 03:14 PM

Great job thanks for taking the time.

xtreme-mobile 02-19-2006 04:41 PM

ive just tried to install this for the 3rd time but i still get the page can not be displayed message when trying to upload attachments

still no fix for this?

Immortal 02-19-2006 05:36 PM

It works just fine in every other browser but IE. I cannot fix IE's faults. Just not humanly possible, so no.

thediablo 02-19-2006 06:58 PM

inmy forum only the first post's are rewrite everything below that is the same.

any suggestions?

xtreme-mobile 02-19-2006 07:01 PM

Quote:

Originally Posted by Immortal
It works just fine in every other browser but IE. I cannot fix IE's faults. Just not humanly possible, so no.


ive used older versions of this hack before using IE and never had any problems

Immortal 02-19-2006 08:03 PM

Quote:

Originally Posted by thediablo
inmy forum only the first post's are rewrite everything below that is the same.

any suggestions?

Either wait a few more hours for 1.0, or scroll back a few pages where I posted the fix.

Quote:

Originally Posted by xtreme-mobile
ive used older versions of this hack before using IE and never had any problems

Not sure why, it's always done it for a forum I moderate for IE users.

Immortal 02-19-2006 10:47 PM

Update - 1.0

Instead of taking all that time to type up all the changes, let's just say you should upgrade.

All known bugs were fixed (that I said was going to be fixed). And you now have the option to turn on 301 redirects. This means that all old threads, like showthread.php?t= will redirect to your new vRewritten one.

This hack is now stable. All users that have been waiting to install it, should now be safe to install.

If you find a bug, please let me know so I can fix in the next version.

Upgrade Instructions

Reimport the product, allowing overwrite.

Reupload .htaccess.

That's it! :)

Happy SEOed URLs!

Bhuwan 02-19-2006 11:17 PM

Quote:

Originally Posted by Immortal
Update - 1.0

Instead of taking all that time to type up all the changes, let's just say you should upgrade.

All known bugs were fixed (that I said was going to be fixed). And you now have the option to turn on 301 redirects. This means that all old threads, like showthread.php?t= will redirect to your new vRewritten one.

This hack is now stable. All users that have been waiting to install it, should now be safe to install.

If you find a bug, please let me know so I can fix in the next version.

Upgrade Instructions

Reimport the product, allowing overwrite.

Reupload .htaccess.

That's it! :)

Happy SEOed URLs!

Great hack! When trying to view a thread, I get "is_ie" javascript errors.

Immortal 02-19-2006 11:21 PM

Quote:

Originally Posted by bchawla
Great hack! When trying to view a thread, I get "is_ie" javascript errors.

Whoa, never heard of that before. Do you have a link?

yayvb 02-19-2006 11:32 PM

Hi Immortal, I'm really glad to see you have 1.0 out woohoo!!!
After overwriting the .htaccess file and overwriting the old product with the new, I once again have this problem:
http://www.420boards.com/example.gif
I was going to follow the workaround that you had posted here:
https://vborg.vbsupport.ru/showpost....&postcount=316
but it seems like that's giving me an error message if I use that code.

Any ideas? I'm desperate!! :)

ps. Before the 1.0 stable came out, the last one I was using I was able to use the above fix to get everything rewritten properly, the only problem was that only the first page of a multi page thread was being rewritten or working properly. Which was different from the previous bug where my users were reaching incorrect threads. :)

But now the above code fix will not work it appears.

Thanks in advance for any help, this hack is awesome and much needed, but it has to work properly, for now I'll uninstall so that my users don't get confused :)

Immortal 02-19-2006 11:34 PM

Can you post your global_complete -> vRewrite code?

yayvb 02-19-2006 11:40 PM

Yeah right now I reverted to what was installed with the latest (ie. no error messages but not rewriting) stable version, but here it is:
Global_Complete
Code:

if($vbulletin->options['vRewrite_on'])
{
if($vbulletin->options['vRewrite_forumrewrite'] == "2") {

#------------------------------
# Replace Forums
#------------------------------
$found = preg_match_all('#<a href="forumdisplay\.php\?f=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        $fid = $matches[1][$i];

        if(!array_key_exists($fid, $vbulletin->forumcache))
            continue;

        $f = $vbulletin->forumcache[$fid];
        $fid = $f['forumid'];
        $title = urlize($f['title']);

        $output = str_replace("<a href=\"forumdisplay.php?f=$fid\"", "<a href=\"siteforums/$title-$fid.html\"", $output);
    }
}


}

#------------------------------
# Replace Forums
#------------------------------
$found = preg_match_all('#<a href="forumdisplay\.php\?f=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        $fid = $matches[1][$i];

        if(!array_key_exists($fid, $vbulletin->forumcache))
            continue;

        $f = $vbulletin->forumcache[$fid];
        $fid = $f['forumid'];
        $title = urlize($f['title']);

        $output = str_replace("<a href=\"forumdisplay.php?f=$fid\"", "<a href=\"f-$title-$fid.html\"", $output);
    }
}

if($vbulletin->options['vRewrite_memberrewrite'] == "2") {
#------------------------------
# Replace User
#------------------------------
$found = preg_match_all('#member\.php\?u=([0-9]+)#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid='".$vbulletin->db->escape_string($ids)."'");

    while($u = $vbulletin->db->fetch_array($res))
    {
        $username = urlize($u['username']);
        $uid = $u['userid'];

        $output = str_replace("member.php?u=$uid", "members/$username-$uid.html", $output);
    }


}
        }
#------------------------------
# Replace User
#------------------------------
$found = preg_match_all('#member\.php\?u=([0-9]+)#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT userid, username FROM " . TABLE_PREFIX . "user WHERE userid='".$vbulletin->db->escape_string($ids)."'");

    while($u = $vbulletin->db->fetch_array($res))
    {
        $username = urlize($u['username']);
        $uid = $u['userid'];

        $output = str_replace("member.php?u=$uid", "u-$username-$uid.html", $output);
    }


}

if(THIS_SCRIPT == 'index') {
#------------------------------
# Replace showthread.php?goto=newpost
#------------------------------
$found = preg_match_all('#<a href="showthread\.php\?goto=newpost&amp;t=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, title FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($n = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($n['title']);
                $tid = $n['threadid'];

        $output = str_replace("<a href=\"showthread.php?goto=newpost&amp;t=$tid\"", "<a href=\"$title-$tid-newpost.html\"", $output);
    }


}

#------------------------------
# Replace showthread.php?goto=lastpost
#------------------------------
$found = preg_match_all('#<a href="showthread\.php\?goto=lastpost&amp;t=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, title FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($n = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($n['title']);
                $tid = $n['threadid'];

        $output = str_replace("<a href=\"showthread.php?goto=lastpost&amp;t=$tid\"", "<a href=\"$title-$tid-lastpost.html\"", $output);
    }


}



}

if(THIS_SCRIPT == 'forumdisplay' OR 'index') {
#------------------------------
# Replace Last Post User (Forum)
#------------------------------
$found = preg_match_all('#<a href="member\.php\?find=lastposter&amp;f=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT
                                          f.forumid,
                                          u.userid, u.username
                                      FROM
                                          " . TABLE_PREFIX . "forum f,
                                          " . TABLE_PREFIX . "user u
                                      WHERE
                                          forumid='".$vbulletin->db->escape_string($ids)."'
                                          AND u.username = f.lastposter");

    while($f = $vbulletin->db->fetch_array($res))
    {
                $lp = urlize($f['username']);
                $lpid = $f['userid'];
                $fid = $f['forumid'];

        $output = str_replace("<a href=\"member.php?find=lastposter&amp;f=$fid\"", "<a href=\"u-$lp-$lpid.html\"", $output);
    }
}


}

if(THIS_SCRIPT == 'forumdisplay') {
#------------------------------
# Replace Last Post User (Thread)
#------------------------------
$found = preg_match_all('#<a href="member\.php\?find=lastposter&amp;t=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT
                                          f.forumid,
                                          u.userid, u.username
                                      FROM
                                          " . TABLE_PREFIX . "forum f,
                                          " . TABLE_PREFIX . "user u
                                      WHERE
                                          forumid='".$vbulletin->db->escape_string($ids)."'
                                          AND u.username = f.lastposter");
    while($f = $vbulletin->db->fetch_array($res))
    {
        $lp = $f['lastposter'];
                $lp = urlize($f['username']);
                $lpid = $f['userid'];
                $tid = $f['threadid'];

        $output = str_replace("<a href=\"member.php?find=lastposter&amp;t=$tid\"", "<a href=\"u-$lp-$lpid.html\"", $output);
    }


}

}
#-----------------------------------
# DO NOT REMOVE OTHERWISE YOU
# WILL BE SENT A DMCA FOR COPYRIGHT
# INFRINGEMENT YOU MAY NOT USE THIS
# PLUGIN WITHOUT THIS LINE OF CODE
# IF YOU WISE TO REMOVE THIS AND
# ADD IT TO YOUR STYLE, FEEL FREE
# AS LONG AS THE COPYRIGHT REMAINS
#-----------------------------------

$output = str_replace("</body>",'<div align="center" class="smallfont">SEOed URLs completed by <a href="http://www.techhelpforum.com">Tech Help Forum</a>.</div></body>',$output);


if($vbulletin->options['vRewrite_showthreadrewrite'] == "2") {
#------------------------------
# SHOWTHREAD
#------------------------------
$found = preg_match_all('#<a href="showthread\.php\?t=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($t = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($t['title']);
                $tid = $t['threadid'];
                $fid = $t['forumid'];
                $foruminfo = $vbulletin->forumcache[$fid];
                $fname = urlize($foruminfo['title']);
                $fname = str_replace("-","",$fname);
                $title = str_replace("-"," ",$title);

        $output = str_replace("<a href=\"showthread.php?t=$tid\"", "<a href=\"$fname/$title-$tid.html\"", $output);
    }


}
        }
#------------------------------
# SHOWTHREAD
#------------------------------
$found = preg_match_all('#<a href="showthread\.php\?t=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($t = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($t['title']);
                $tid = $t['threadid'];
                $fid = $t['forumid'];
                $foruminfo = $vbulletin->forumcache[$fid];
                $fname = urlize($foruminfo['title']);

        $output = str_replace("<a href=\"showthread.php?t=$tid\"", "<a href=\"$fname/t-$title-$tid.html\"", $output);
    }


}

#------------------------------
# SHOWTHREAD and page
#------------------------------
$found = preg_match_all('#showthread\.php\?t=([0-9]+)&amp;page=([0-9]+)#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    // Keep track of page nums that go with tid's
    $temp = array();

    for($i = 0; $i < $found; $i++)
    {
        // $temp[<threadid>] = <page>
        $temp[ $matches[1][$i] ] = $matches[2][$i];

        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, forumid, title FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($t = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($t['title']);
                $tid = $t['threadid'];
                $fid = $t['forumid'];
                $foruminfo = $vbulletin->forumcache[$fid];
                $fname = urlize($foruminfo['title']);
        $page = $temp[$tid];
               

        $output = str_replace("showthread.php?t=$tid&amp;page=$page", "$fname/t-$title-$tid-page-$page.html", $output);


        }


}

if(THIS_SCRIPT == 'showthread') {
#------------------------------
# showpost
#------------------------------
$found = preg_match_all('#<a href="showpost\.php\?p=([0-9]+)&amp;postcount=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
                $temp[ $matches[1][$i] ] = $matches[2][$i];
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);


    // Go through each
    $res = $vbulletin->db->query_read("SELECT postid, title FROM " . TABLE_PREFIX . "post WHERE postid='".$vbulletin->db->escape_string($ids)."'");

    while($p = $vbulletin->db->fetch_array($res))
    {
                $pid = $p['postid'];
                $postcount = $temp[$pid];
                $output = str_replace("<a href=\"showpost.php?p=$pid&amp;postcount=$postcount\"", "<a href=\"p-$pid.html\"", $output);   
       
        }



}



#------------------------------
# Print SHOWTHREAD
#------------------------------
$found = preg_match_all('#<a href="printthread\.php\?t=([0-9]+)"#i', $output, $matches);



if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, title FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($t = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($t['title']);
                $tid = $t['threadid'];

        $output = str_replace("<a href=\"printthread.php?t=$tid\"", "<a href=\"print-$title-$tid.html\"", $output);
    }


}

#------------------------------
# Email SHOWTHREAD
#------------------------------
$found = preg_match_all('#<a href="sendmessage\.php\?do=sendtofriend&amp;t=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, title FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($t = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($t['title']);
                $tid = $t['threadid'];

        $output = str_replace("<a href=\"sendmessage.php?do=sendtofriend&amp;t=$tid\"", "<a href=\"sendtofriend-$title-$tid.html\"", $output);
    }


}

#------------------------------
# Prev/Next Threads
#------------------------------
$found = preg_match_all('#<a href="showthread\.php\?t=([0-9]+)&amp;goto=nextnewest"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
               
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);


    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, title, forumid FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($t = $vbulletin->db->fetch_array($res))
    {
                $tid = $t['threadid'];
                $title = urlize($t['title']);
                $fid = $t['forumid'];
                $f = $vbulletin->forumcache[$fid];
                $fname = urlize($f['title']);
                $output = str_replace("<a href=\"showthread.php?t=$tid&amp;goto=nextnewest\"", "<a href=\"$fname/$title-$tid-nextnewest.html\"", $output);   
       
        }
}
       
#------------------------------
# Prev/Next Threads
#------------------------------
$found = preg_match_all('#<a href="showthread\.php\?t=([0-9]+)&amp;goto=nextoldest"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
               
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);


    // Go through each
    $res = $vbulletin->db->query_read("SELECT threadid, title, forumid FROM " . TABLE_PREFIX . "thread WHERE threadid='".$vbulletin->db->escape_string($ids)."'");

    while($t = $vbulletin->db->fetch_array($res))
    {
                $tid = $t['threadid'];
                $title = urlize($t['title']);
                $fid = $t['forumid'];
                $f = $vbulletin->forumcache[$fid];
                $fname = urlize($f['title']);
                $output = str_replace("<a href=\"showthread.php?t=$tid&amp;goto=nextoldest\"", "<a href=\"$fname/$title-$tid-nextoldest.html\"", $output);   
       
        }



}

}

#------------------------------
# New Thread
#------------------------------
$found = preg_match_all('#<a href="newthread\.php\?do=newthread&amp;f=([0-9]+)"#i', $output, $matches);


if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT forumid, title FROM " . TABLE_PREFIX . "forum WHERE forumid='".$vbulletin->db->escape_string($ids)."'");

    while($f = $vbulletin->db->fetch_array($res))
    {
        $title = urlize($f['title']);
                $fid = $f['forumid'];

        $output = str_replace("<a href=\"newthread.php?do=newthread&amp;f=$fid\"", "<a href=\"$title-$fid/newthread.php\"", $output);
    }


}

#------------------------------
# New Post
#------------------------------
$found = preg_match_all('#<a href="newreply\.php\?do=newreply&amp;noquote=1&amp;p=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT p.threadid, p.postid, t.title, t.forumid FROM " . TABLE_PREFIX . "post p, " . TABLE_PREFIX . "thread t WHERE p.postid='".$vbulletin->db->escape_string($ids)."' AND t.threadid = p.threadid");

    while($t = $vbulletin->db->fetch_array($res))
    {
                $tid = $t['threadid'];
                $pid = $t['postid'];
                $title = urlize($t['title']);
                $fid = $t['forumid'];
                $f = $vbulletin->forumcache[$fid];
                $fname = urlize($f['title']);

                $output = str_replace("<a href=\"newreply.php?do=newreply&amp;noquote=1&amp;p=$pid\"", "<a href=\"$fname/newpostnoquote-$pid.php\"", $output);
    }


}

#------------------------------
# New Post
#------------------------------
$found = preg_match_all('#<a href="newreply\.php\?do=newreply&amp;p=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT p.threadid, p.postid, t.title, t.forumid FROM " . TABLE_PREFIX . "post p, " . TABLE_PREFIX . "thread t WHERE p.postid='".$vbulletin->db->escape_string($ids)."' AND t.threadid = p.threadid");

    while($t = $vbulletin->db->fetch_array($res))
    {
                $tid = $t['threadid'];
                $pid = $t['postid'];
                $title = urlize($t['title']);
                $fid = $t['forumid'];
                $f = $vbulletin->forumcache[$fid];
                $fname = urlize($f['title']);

                $output = str_replace("<a href=\"newreply.php?do=newreply&amp;p=$pid\"", "<a href=\"$fname/newpost-$pid.php\"", $output);
    }


}

#------------------------------
# Search
#------------------------------
$found = preg_match_all('#<a href="search\.php\?searchid=([0-9]+)"#i', $output, $matches);

if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT userid, searchid FROM " . TABLE_PREFIX . "search WHERE searchid='".$vbulletin->db->escape_string($ids)."'");

    while($s = $vbulletin->db->fetch_array($res))
    {
        $userid = $s['userid'];
                $searchid = $s['searchid'];
               

        $output = str_replace("search.php?searchid=$searchid", "search-$userid-$searchid.html", $output);
    }


}

if(THIS_SCRIPT == 'memberlist') {

#------------------------------
# Memberlist
#------------------------------
$found = preg_match_all('#<a href="memberlist\.php\?ltr=([A-Z]+)&amp;pp=0&amp;sort=username&amp;order=asc"#i', $output, $matches);


if($found)
{
    // Build an array of ID's
    $ids = array();

    for($i = 0; $i < $found; $i++)
    {
        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
                        $ltr = $matches[1][$i];
        $output = str_replace("<a href=\"memberlist.php?ltr=$ltr&amp;pp=0&amp;sort=username&amp;order=asc\"", "<a href=\"memberlist-$ltr-0-username-asc.html\"", $output);

    }
    $ids = implode(',', $ids);




}
}

if(THIS_SCRIPT == 'forumdisplay') {

#------------------------------
# Forum Pages
#------------------------------
$found = preg_match_all('#forumdisplay\.php\?f=([0-9]+)&amp;page=([0-9]+)&amp;order=desc#i', $output, $matches);
if($found)
{
    // Build an array of ID's
    $ids = array();

    // Keep track of page nums that go with fid's
    $temp = array();

    for($i = 0; $i < $found; $i++)
    {
        // $temp[<forumid>] = <page>
        $temp[ $matches[1][$i] ] = $matches[2][$i];

        if(is_numeric($matches[1][$i]))
            $ids[] = $matches[1][$i];
    }
    $ids = implode(',', $ids);

    // Go through each
    $res = $vbulletin->db->query_read("SELECT title, forumid FROM " . TABLE_PREFIX . "forum WHERE forumid IN($ids)");

    while($f = $vbulletin->db->fetch_array($res))
    {
                $title = urlize($f['title']);
                $fid = $f['forumid'];
        $page = $temp[$fid];
               

        $output = str_replace("forumdisplay.php?f=$fid&amp;page=$page&amp;order=desc", "f-$title-desc-$page.html", $output);


        }


}


}



#------------------------------
# misc pages
#------------------------------
$output = str_replace("search.php?do=getnew","search-getnew.html",$output);
$output = str_replace("search.php?do=getdaily","search-getdaily.html",$output);
$output = str_replace("forumdisplay.php?do=markread","markread.html",$output);
}

/**
 * Turn a string into a URL friendly string
 *
 * @param string $txt The string to work on
 * @return string The new string
 */
function urlize($txt)
{
    $txt = unaccent($txt);
    $txt = html_entity_decode($txt);
    $txt = str_replace(' ', '-', $txt);
    $txt = preg_replace('#[^a-zA-Z0-9_\-]+#', '', $txt);
    $txt = preg_replace('#[\-]+#', '-', $txt);

    return strtolower($txt);
}

/**
 * Turn accented characters into normal characters
 *
 * @param string $txt The string to remove the accents from
 * @return string Your new clean string
 */
function unaccent($txt)
{
    $trans = get_html_translation_table(HTML_ENTITIES);
   
    foreach($trans as $literal => $entity)
    {
        if(ord($literal) >= 192)
        {
            $search[]  = $literal;
            $replace[]  = substr($entity, 1, 1);
        }
    }

    return str_replace($search, $replace, $txt);
}

I'll leave it running on my board right now. It's just like the picture shows. :)

Bhuwan 02-20-2006 12:02 AM

The problem is i can't add the following code to my styles :-(
Code:

<if THIS_SCRIPT != 'index'>
<base href="$vboptions[bburl]/" />
</if>

it freezes attempting to add this and the server load jumps through the roof!
, load average: 11.67, 9.81, 8.45

Immortal 02-20-2006 12:13 AM

yayvb -> I'll look into it...it should work.

bchawla -> Let me double check, but I thought that was right :S

Bhuwan 02-20-2006 12:27 AM

Quote:

Originally Posted by Immortal
yayvb -> I'll look into it...it should work.

bchawla -> Let me double check, but I thought that was right :S

Thanks!
its wierd -- if I attempt to add that code to a a style from vbDesigns.de, it adds the code fine
HOwever, if I add the code to a vb default style, it freezes

My serv er loads are really high now, not dropping- i dont want to reboot the server - I am hopng Rackspace can fix the issue (w/o reboot)

Immortal 02-20-2006 12:32 AM

Ah, got it.

Code:

<if condition="THIS_SCRIPT != 'index'">
<base href="$vboptions[bburl]/" />
</if>

I'm updating install.html now. Thanks :)

Bhuwan 02-20-2006 12:49 AM

Quote:

Originally Posted by Immortal
Ah, got it.

Code:

<if condition="THIS_SCRIPT != 'index'">
<base href="$vboptions[bburl]/" />
</if>

I'm updating install.html now. Thanks :)

thanks for your help! :) early results from my side show that was a tad bit b etter :)

Immortal 02-20-2006 12:59 AM

Thanks for that...I thought I had it correct, but apprently not. :)

Updated ZIP as well.

yayvb 02-20-2006 01:02 AM

Eek, let me get back to you in a few minutes. Apparently this time I saved the files into a directory called newvrewrite and last time I saved them into a directory called vrewrite-new so this time when I saw that my .htaccess anx .xml was the same, it was because I am importing everything from before!!! :)

Let me give the "New" LMAO files a whirl and I'll let you know what I find!! lol

But I am having trouble with adding the above little code snipet to the headinclude template. It times out or whatever and then I see no change.

yayvb 02-20-2006 01:14 AM

Everything on the front page looked good, but I just noticed the links on the front are being rewritten properly, but when you click on them you don't go to where it says you should go, you end up at a different random topic altogether. I just disabled so don't go for a reference, but when you hover a link it shows a valid rewritten .html url, but when you click it it brings you to different ones, but not the right one.

*EDIT* I am very excited that it looks like it will be working for me soon!! I have a feeling it's not just me or my server where the links are going to the wrong places. It looks like maybe only the the thread links on forumhome

Immortal 02-20-2006 01:37 AM

Quote:

Originally Posted by yayvb

But I am having trouble with adding the above little code snipet to the headinclude template. It times out or whatever and then I see no change.

Make sure you are using the new one.

Quote:

Originally Posted by yayvb
Everything on the front page looked good, but I just noticed the links on the front are being rewritten properly, but when you click on them you don't go to where it says you should go, you end up at a different random topic altogether. I just disabled so don't go for a reference, but when you hover a link it shows a valid rewritten .html url, but when you click it it brings you to different ones, but not the right one.

*EDIT* I am very excited that it looks like it will be working for me soon!! I have a feeling it's not just me or my server where the links are going to the wrong places. It looks like maybe only the the thread links on forumhome

Weird, can you reproduce it on my forums? And provide a link, please?


All times are GMT. The time now is 09:06 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.02974 seconds
  • Memory Usage 2,015KB
  • 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
  • (5)bbcode_code_printable
  • (20)bbcode_quote_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
  • (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