Welcome, Guest. Please Login or Register.
November 25, 2024, 05:45:08 PM
Home Help Search Log in Register
News: SMF is the next generation in forum software, almost completely re-written from the ground up, make sure you don't fall for cheap imitations that suffer from feature bloat!

YaBB SE Community  |  Development  |  Completed mods  |  [beta 1.5.4] Friendly URLs v1.3 « previous next »
Pages: 1 [2] 3 4 Reply Ignore Print
Author Topic: [beta 1.5.4] Friendly URLs v1.3  (Read 31422 times)
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #15 on: September 09, 2003, 11:06:45 PM »
Reply with quote

I figured it out.  I had to add:

AcceptPathInfo On

To my Directory Container in httpd.conf.  This turns on the Lookback function.  Aparently, that is enabled by default in Apache1, but is not in Apache2.
Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #16 on: September 09, 2003, 11:29:31 PM »
Reply with quote

Quote from: dschwab9 on September 09, 2003, 11:06:45 PM
I figured it out.  I had to add:

AcceptPathInfo On

To my Directory Container in httpd.conf.  This turns on the Lookback function.  Aparently, that is enabled by default in Apache1, but is not in Apache2.

cool :)

is your forum working with the mod now?
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #17 on: September 09, 2003, 11:30:23 PM »
Reply with quote

Something else I came across is the Photo Gallery mod didn't work (it uses ?action=gallery), it just displayed the forum index.

I did this to fix it:

   function rewrite_url($match) {
      if(strstr($match['0'], 'search2')) {
         return $match['0'];
      } elseif(strstr($match['0'], 'gallery')) {
         return $match['0'];
      } else {
         $arr1 = array("=", ";", "&", "?");
         $arr2 = array("-", "_", "_", "/");
         return str_replace($arr1, $arr2, $match['0']);
      }


Is that ok, or is there a less expensive way to do the same thing?
« Last Edit: September 09, 2003, 11:43:10 PM by dschwab9 » Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #18 on: September 09, 2003, 11:37:24 PM »
Reply with quote

what you did is fine, you can make that code shorter putting the two conditions in the same if, separated with ||

function rewrite_url($match) {
     if(strstr($match['0'], 'search2') || strstr($match['0'], 'gallery')) {
        return $match['0'];
     } else {
        $arr1 = array("=", ";", "&", "?");
        $arr2 = array("-", "_", "_", "/");
        return str_replace($arr1, $arr2, $match['0']);
     }


I'm working on fixing the code so that the url will only be rewritten when pointing to the forum
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #19 on: September 09, 2003, 11:46:21 PM »
Reply with quote

Quote from: Anguz on September 09, 2003, 11:29:31 PM
is your forum working with the mod now?

Yep, it's now working  (perfectly, as far as I can tell)

http://bbs.zuwharrie.com/

I've re-submitted to Google, so I should see what happens soon.  The googlebot has been visiting regularly, but only requesting 3-5 pages per visit.  In the past, it looks at the main index and the index of each board, but never individual posts.
Logged
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #20 on: September 10, 2003, 07:59:23 AM »
Reply with quote

I just took it a step further and set up an apache alias /content to index.php, then modified your code and subs.php to use that.

So now, I have even prettier URL's, like: http://bbs.zuwharrie.com/content/board-12_action-display_threadid-1928


* dschwab9 like!  ;D
Logged
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #21 on: September 10, 2003, 08:51:53 AM »
Reply with quote

Sorry to make a Zillion posts in your thread  :P but I found another issue.

A URL that contains a username doesn't work if the username has a dash or underscore.

For example, I have a user "X-Jeeper" and user "got_zuk".  They get truncated to "X" and "got" and give a error that there's no such user.

So, I'm now running this:
if(strstr($match['0'], 'search2') || strstr($match['0'], 'gallery') || strstr($match['0'], 'profile') || strstr($match['0'], 'imsend') || strstr($match['0'], 'chat')) {
         return $match['0'];
« Last Edit: September 10, 2003, 08:55:16 AM by dschwab9 » Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #22 on: September 10, 2003, 04:37:31 PM »
Reply with quote

I don't mind it at all, you're helping me a lot with what you're finding

although I tested in my board a lot, I didn't have that problem with the names cause my members don't use "-" or "_"

I didn't know about the gallery either, cause I don't have it installed

also the Apache setting, I didn't know

thank you very much for your help! I'll improve this mod even more :D
Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #23 on: September 11, 2003, 02:06:10 AM »
Reply with quote

The spiders definately like it.

Google has pulled 92 pages so far today.  I've never had them take more than 10 in a week in the past, and it has never gone deeper than the board index.

Quotealso the Apache setting, I didn't know
Speaking of the Apache setting, that can also be done in a .htaccess file.  I'm on a dedicated server and have root access, so I generally put anything that would go in a htaccess file in httpd.conf for speed reasons.
« Last Edit: September 11, 2003, 02:09:05 AM by dschwab9 » Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #24 on: September 11, 2003, 02:16:33 AM »
Reply with quote

Quote from: dschwab9 on September 11, 2003, 02:06:10 AM
The spiders definately like it.

great :D

where do you see what the spider indexes?
« Last Edit: September 11, 2003, 02:51:02 AM by Anguz » Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
dschwab9
Full Member
***
Posts: 144


I'm a llama!

WWW
Re:[beta 1.5.4] Friendly Urls v1.1
« Reply #25 on: September 11, 2003, 02:19:09 AM »
Reply with quote

go to google and search for site:www.yoursite.com along with a word you know is on every page,  and it will return all the pages it has indexed.
« Last Edit: September 11, 2003, 02:20:13 AM by dschwab9 » Logged
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Friendly Urls v1.2
« Reply #26 on: September 11, 2003, 03:41:13 AM »
Reply with quote

cool, thx for the tip ;)

I just improved the mod a bit more:

- the urls are now relative when the link is pointing inside the forum (even inside msgs like this one, they work well)

- only the urls to the forum will be changed (before, if you had a url to another script named "index.php?..." it'd be changed too, even if it was somewhere else)

Shadow's Pawn, try using this new version, it may solve the problem you were having... pls let me know how it goes
« Last Edit: September 11, 2003, 03:42:35 AM by Anguz » Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
Shadow's Pawn
Support Team
YaBB God
*****
Posts: 597


ich soll nicht toten

ICQ - 8039201shadowpawn@hotmail.com WWW
Re:[beta 1.5.4] Friendly Urls v1.2
« Reply #27 on: September 11, 2003, 12:44:45 PM »
Reply with quote

It still doesn't work, but it does work better than before... I posted something at pfabb to see if anyone there can help me out.  I know very little about url_rewrite or anything like that, so I'm not much use.

I'm pretty sure it has to do with the menu system that pfabb employs, so I'll probably just have to wait for a "conversion" of it, if anyone has time to make it over there.  If not, I guess I'll have to go learn some more php, heheh.

I'll get back to you when I find out more.  

Oh, and great mod.  I've installed it on my boards that don't run any portals and it works great.
Logged

apologize \A*pol"o*gize\, v. i. - To lay the foundation for a future offense.
Michele
Beta Tester
YaBB God
*****
Posts: 584


I can't wait for YaBB SE 2!

Mad+Moya WWW
Re:[beta 1.5.4] Friendly Urls v1.2
« Reply #28 on: September 11, 2003, 03:17:52 PM »
Reply with quote

Actually, I think it has to do with us using "index.php?op=forum" to reach the forums instead of just index.php .

I haven't a clue yet how to fix it though. :(
Logged

formerly Mad Moya
PfaBB - http://pfabb.lunabyte.com
Anguz
YaBB God
*****
Posts: 641


llama me?!

WWW
Re:[beta 1.5.4] Friendly Urls v1.2
« Reply #29 on: September 12, 2003, 03:50:15 PM »
Reply with quote

Quote from: Shadow's Pawn on September 11, 2003, 12:44:45 PM
It still doesn't work, but it does work better than before... I posted something at pfabb to see if anyone there can help me out.  I know very little about url_rewrite or anything like that, so I'm not much use.

I posted this at pfabb, but am posting here too so others can read it as well

the problem was with relative urls (thx [Unknown] for helping me figure it out when working on version 1.2)

try this

#change urls to friendly format -pfabb
ob_start('ob_friendly_url');
function ob_friendly_url($buffer)
{
  function rewrite_url($match) {
     global $boardurl, $scripturl;
     #it has "http", it's not relative url
     if(strstr($match['2'], 'http')) {
        #it has $_SERVER['SERVER_NAME'], it's in this server
        if (strstr($match['2'], str_replace('www.', '', $_SERVER['SERVER_NAME']))) {
           #it has $scripturl in it
           if(strstr($match['2'], $scripturl)) {
              #it has "op=, search, profile, chat, gallery or imsend", leave it alone
              if(strstr($match['3'], 'search') || strstr($match['3'], 'gallery') || strstr($match['3'], 'profile') || strstr($match['3'], 'imsend') || strstr($match['3'], 'chat')) {
                 return $match['1'] . '="' . $_SERVER['SCRIPT_NAME'] . $match['3'] . '"';
              #it doesn't have those, replace symbols in vars and make relative
              } else {
                 $arr1 = array("=", ";", "&", "?");
                 $arr2 = array("-", "_", "_", "/");
                 return $match['1'] . '="' . $_SERVER['SCRIPT_NAME'] . str_replace($arr1, $arr2, $match['3']) . '"';
              }
           #it has $boardurl in it, make it relative
           } elseif(strstr($match['2'], $boardurl)) {
              return $match['1'] . '="' . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . str_replace($boardurl . '/', '', $match['2']) . $match['3'] . '"';
           #it doesn't have $boardurl in it, leave it alone
           } else {
              return $match['0'];
           }
        #it doesn't have $_SERVER['SERVER_NAME'], it's in another server, leave it alone
        } else {
           return $match['0'];
        }
     #doesn't have "http", it's relative
     } else {
        #it doesn't start with "/", make it relative to the root
        if($match['2']{0} != '/') {
           return $match['1'] . '="' . str_replace('index.php', '', $_SERVER['SCRIPT_NAME']) . $match['2'] . $match['3'] . '"';
        #it starts with "/", it's relative to the root, it'll work fine
        } else {
           return $match['0'];
        }
     }
  }
  return preg_replace_callback('/(href|src)=\"([\w.:\-~\/]*)(\??[\w;=&+%]*)\"/i', "rewrite_url", $buffer);
}


the urls are working now, and those that weren't relative, are now (I just found the parse_url function, so I may change some parts to make it more readable, but it's working as it is)

there's one bug though, this url won't work
http://anguz.net/PfaBB07/index.php/board-1
but this one will
http://anguz.net/PfaBB07/index.php/board-1_action-display_threadid-1
this one works though
http://anguz.net/PfaBB07/index.php?board=1

???

any idea why this could be? I went over the code in index.php, subs.php and messageindex.php and can't come up with the reason for it to behave like that
« Last Edit: September 12, 2003, 03:52:05 PM by Anguz » Logged

My Mods: Avatar & Sig Size Control, No Show Msg Subject, Msg URL Composer, Built-in Avatar Rand, Built-in Sig Rand, Remove New-lines Excess, Show All Stars, Search Bar, Smart URLs
Pages: 1 [2] 3 4 Reply Ignore Print 
YaBB SE Community  |  Development  |  Completed mods  |  [beta 1.5.4] Friendly URLs v1.3 « previous - next »
 


Powered by MySQL Powered by PHP YaBB SE Community | Powered by YaBB SE
© 2001-2003, YaBB SE Dev Team. All Rights Reserved.
SMF 2.1.4 © 2023, Simple Machines
Valid XHTML 1.0! Valid CSS

Page created in 0.034 seconds with 20 queries.