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  
 
   
Prepare profile url & UTF8

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 mod Rewrite  » Advanced SEO URL
::  
Author Message
ALEXIS



Joined: 27 Nov 2006
Posts: 3

Prepare profile url & UTF8Posted: Tue Jan 22, 2008 8:38 pm    Post subject: Prepare profile url & UTF8

I fixed format_url() for many UTF-8 char, but my fix don't work set_user_url()

member name is "member/üğışçö"

url is "member/%25C3%25BC%25C4%259F%25C4%25B1%25C5%259F%25C3%25A7%25C3%25B6"

how fix convert to "member/ugisco"


my format_url() fix:

Code:
[ OPEN ]

phpbb_seo/phpbb_seo_class.php

[ FIND ]

      $this->seo_path['phpbb_script'] =  $script_path;

AFTER ADD

//-- [+] Turkish fix ----------------------------------------------------
//-- add
//
      // --> Custom str_Replace arrays, to handle special cases properly
      $this->seo_opt['url_find'] = array(
         utf8_chr(286),utf8_chr(287), // g
         utf8_chr(304),utf8_chr(305), // i
         utf8_chr(350),utf8_chr(351), // s
      );
      $this->seo_opt['url_replace'] = array('g', 'g', 'i', 'i','s', 's');
//
//-- [-] Turkish fix ----------------------------------------------------

[ FIND ]

      $url = preg_replace('`\[.*\]`U','',$url);

[ AFTER ADD ]

//-- [+] Turkish fix ----------------------------------------------------
//-- add
//
      $url = str_replace( $this->seo_opt['url_find'], $this->seo_opt['url_replace'], $url );
//
//-- [-] Turkish fix ----------------------------------------------------
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 14854

Prepare profile url & UTF8Posted: Thu Jan 24, 2008 1:18 pm    Post subject: Re: Prepare profile url & UTF8

Well, this is not exactly a fix.

I mean, the fix for the regular urls such as forum and topic is the valid one, but for nicknames you cannot do like this.

Because a page like member/nickname will query for the user name in order to find out the proper infos, if you remove the accents, it won't match anymore, or, if you made it to circumvent the select without accents, nicknames won't be unique anymore, since joe and joé won't be two different user anymore.

That's why Id removal for profile url is made optional, because it's only comfortable to use with alphanumeric characters. The url_encode method is required to fully comply with the application needs and can output some really ugly code with utf-8 accentuated characters, like your example.

And there is another limitation, FF seems to send the URI encoded in latin1 where IE and opera will do it using UTF-8. This, together with the Apache mod_rewrite "bug" with "&" adds extra levels of complexity to be taken into account too :


install wrote:
__________________________________________________
NOTE: profile and user messages pages ID removing:
__________________________________________________

phpBB/member/nicknames VS phpBB/nicknames-uxx.html And phpBB/messages/nicknames VS dephpBB/nicknames-mxx.html

If you use profile and / or user messages pages ID removing, you should know that some urlencode
will be used by some browsers such as Firefox.
As well, a bug with mod_rewrite requires some custom url encoding to handle the "&" case proper in user names.
For example a user named rock&roll will require rock%2526roll (double urlencoded &) to be usable.
( http://www.php.net/urlencode => http://issues.apache.org/bugzilla/show_bug.cgi?id=34602 )

There are other issues with custom characters, like accents, which will add some urlencoded chars in urls.
It's not an SEO issue, since bots knows about urlencoding, but it can end up building pretty long url with multi byte characters.
This does not concern the a-zA-Z0-9 chars, underscore ("_"), hyphen ("-") and dot (".") included.
In phpbb_seo/phpbb_seo_class.php, you can decide to use different methods :

$this->seo_opt['custom_url_endode'] = 1;

You can change the value, to 1, 2 and 3.
$this->seo_opt['custom_url_endode'] = 1, nickname is pretty much injected as is, after it is
htmlspecialchars_decoded, encoded in UTF-8 and filtered for the "&" case.
This means you will let the browser decide, FF will most likely use urlencoded chars
if your user are using more than alphanumeric chars, but IE and Opera should do the trick.

$this->seo_opt['custom_url_endode'] = 2, would mean to impose urlencoding on all links, with the double urlencoding trick on "&".
Should handle more special cases, but imposes urlencoding for all browsers.

$this->seo_opt['custom_url_endode'] = 3, double urlencode everything, most likely the safest way for desperate cases Very Happy
Should handle pretty much all cases, but imposes double urlencoding for all browsers.

This of course means that the ID removing on profile and user messages pages is more comfy and universally efficient
to use with alphanumeric chars user names (without accents).
Other cases are heavier and are more meant to handle few exceptions than to do the trick with multi byte chars in general.
Here, it's mostly Firefox to limit us a bit.

If you only allow alphanumeric chars for your user nicknames, then you can make the injection process faster by adding :

return $url;

right after :

function seo_url_encode( $url, $type = 1 ) {

Remember that keeping the ID here will always work.

_________________
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  » phpBB3 mod Rewrite  » Advanced SEO URL
Page 1 of 1

Navigation Similar Topics

Jump to: