phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
More readable URLs for advanced MOD rewrite

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB mod Rewrite
::  
Author Message
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 795

More readable URLs for advanced MOD rewritePosted: Tue Dec 26, 2006 12:41 am    Post subject: More readable URLs for advanced MOD rewrite

I understand the main motivation for the phpBB MOD rewrites is more search engine friendly URLs, but what intrigues me is the advanced MOD's more people friendly URLs. Last night while I was waiting for the little ones to settle down, I installed the MOD on a local installation. EasyMOD tripped over a couple matches and the .htaccess stuff is always tricky, but overall it went smoothly.

To get an idea of how the URLs were transformed, I perused a few hundred titles from my forum. I noticed that some URLs looked "strange" without the apostrophes, so I modified the function below to pretty them up a little, e.g.

    1-000-000-000 -> 1000000
    i-ll -> i will
    & (ignored) -> and
    they-ve -> they have
OK, it's not particular sophisticated, but it does seem more readable to me. I suppose one downside of more readable URLs is less forum members will use the [url=]...[/url] tag.

Code:
function format_url($url)
{
   $url = preg_replace("(\[.*\])U","",$url);
   $url = str_replace (' & ', ' and ', $url); //dan & -> -and-   
   $url = ereg_replace('([0-9])[,]([0-9])', '\\1\\2', $url); //dan 1,000 -> 1000
   $url = ereg_replace('([A-Z])[\.]([A-Z])', '\\1\\2', $url); //dan U-S-A. -> USA
   $find = array('"','\r\n','\n'); //dan removed &
   $url = str_replace ($find, '-', $url);
   $url = str_replace ('ß', 'ss', $url);
   $url = str_replace (array('ö','Ö'), 'oe', $url);
   $url = str_replace (array('ä','Ä'), 'ae', $url);
   $url = str_replace (array('ü','Ü'), 'ue', $url);
   $find = "ÀÁÂÃÅàáâãåÒÓÔÕØòóôõøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛùúûÿÑñ";
   $replace = "AAAAAaaaaaOOOOOoooooEEEEeeeeCcIIIIiiiiUUUuuuyNn";
   $url = strtr($url,$find,$replace);
   $url = strtolower($url);
   $url = str_replace ('\'s', 's', $url); //dan mary-s -> marys, it-s -> its
   $url = str_replace ('\'t', 't', $url); //dan can-t -> cant, won-t -> wont
   $url = str_replace ('\'ve', ' have', $url); //dan i-ve -> i have
   $url = str_replace ('\'ll', ' will', $url); //dan i-ll -> i-will
   $url = ereg_replace("[^a-zA-Z0-9]", "-", $url);
   while (strstr($url, '--')) $url = str_replace('--', '-', $url);
   $url = (substr($url, 0, 1) == '-') ? substr($url, 1) : $url;
   $url = (substr($url, strlen($url) - 1, 1) == '-') ? substr($url, 0, strlen($url) - 1) : $url;
   return $url;
}

_________________
Dan Kehn
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

More readable URLs for advanced MOD rewritePosted: Tue Dec 26, 2006 10:23 am    Post subject: Re: More readable URLs for advanced MOD rewrite

If it's only a matter of dealing with ', you could just replace them all with nothing instead of Hyphens like for now.

Adding :

Code:
   $url = str_replace ("'", '', $url);


After :

Code:
   $url = str_replace (array('ü','Ü'), 'ue', $url);



But be careful, even with the zero dupe you don't want to change all of your urls every other day.


++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 795

More readable URLs for advanced MOD rewritePosted: Tue Dec 26, 2006 2:37 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

dcz wrote:
If it's only a matter of dealing with ', you could just replace them all with nothing instead of Hyphens like for now.

True, but it's a language-specific issue; I wouldn't recommend that approach for English. Some contractions read well even without the apostrophe, others don't (e.g., "ill" versus "whats"). A minor change for a minor improvement, I suppose.

_________________
Dan Kehn
Back to top
Visit poster's website
HB
phpBB SEO Team
phpBB SEO Team


Joined: 16 Oct 2006
Posts: 795

More readable URLs for advanced MOD rewritePosted: Fri Jul 06, 2007 4:57 am    Post subject: Re: More readable URLs for advanced MOD rewrite

Today I noticed that blogspot removes "the" / "a" / "an" and similar short words from its generated URLs. phpBB-seo URL generator may wish to follow suit.

_________________
Dan Kehn
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

More readable URLs for advanced MOD rewritePosted: Sun Jul 08, 2007 4:38 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

we could easily remove all words being shorten than 3 characters for example.
Would be better to avoid a loop though, in format_url().

I'll perform some testing, here is already a solution without loops :

Replace :
Code:
      $url = preg_replace( array('`[^a-z0-9]`i', '`[-]+`') , '-', $url);


with :

Code:
      $url = preg_replace( array('`[^a-z0-9]`i', '`-[a-z]{1,2}-`i', '`[-]+`') , '-', $url);


in phpbb_seo_class.php, will get rid of most latin1 char set words with less than three letters. The problem is that as is, not all case will be handled, like a topic title starting with a word of less than three letters and some other exceptions.

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
Xabi
PR0
PR0


Joined: 20 Jun 2007
Posts: 50

More readable URLs for advanced MOD rewritePosted: Wed Jul 25, 2007 5:49 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

dcz wrote:
Code:
      $url = preg_replace( array('`[^a-z0-9]`i', '`-[a-z]{1,2}-`i', '`[-]+`') , '-', $url);


in phpbb_seo_class.php, will get rid of most latin1 char set words with less than three letters. The problem is that as is, not all case will be handled, like a topic title starting with a word of less than three letters and some other exceptions.

++


Could you please publish a solution that works in all cases? I'm very very interested on this. I would like to get rid of ALL words with less than 3 characters. Thank you.
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

More readable URLs for advanced MOD rewritePosted: Fri Jul 27, 2007 5:50 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

RC3 will Wink

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
Xabi
PR0
PR0


Joined: 20 Jun 2007
Posts: 50

More readable URLs for advanced MOD rewritePosted: Fri Jul 27, 2007 5:52 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

Shocked I definitely NEED that RC3 version! Please check my last messages at http://www.phpbb-seo.com/boards/advanced-seo-url/discussions-vt1369.html#10301
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

More readable URLs for advanced MOD rewritePosted: Fri Jul 27, 2007 7:25 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

Maybe you' be lucky, but honestly, I cannot tell, keep faith Wink

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
tweety
PR0
PR0


Joined: 24 Jan 2007
Posts: 93

More readable URLs for advanced MOD rewritePosted: Sat Jul 28, 2007 7:34 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

dcz wrote:
RC3 will Wink


is this for phpb2 or phpbb3


i am not sure about using phpbb3 for at least a year
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

More readable URLs for advanced MOD rewritePosted: Fri Aug 03, 2007 2:50 pm    Post subject: Re: More readable URLs for advanced MOD rewrite

phpBB3 for now, but we'll soon back-port all the new feature developed while playing with phpBB3 Wink

++

_________________
Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Back to top
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB mod Rewrite
Page 1 of 1

Navigation Similar Topics

Jump to: