Setup and cyrillic char-set

Discussions and support about the different URL Rewriting techniques for phpBB.

Moderator: Moderators

Setup and cyrillic char-set

Postby akon » Tue Apr 21, 2009 12:51 am

Q1: How can to remove www from my domain?

E.g. -http://www.sample.com to make it -http://sample.com (no matter by hand or not).

Q2: My board is not on latin keyboard. I`ts on cyrillic alphabet (work perfect under utf-8 or cp-1251 or win-1251) so topics are too on cyrillic. Can I make topic title to be rewriten in links from cyrillic to latin to be indexed latin charset instead of "topic-xx".

Example: I have topic title "тема едно" what i want mod to rewrite on "tema edno" or otherwise how to make mod to change all alphabet from cyrillic letter to latin letter for topic title. E.g. А=А, B=Б, C=Ц and so on...

P.S. Sorry my terrable english, i`m from Bg.
akon
 
Posts: 8
Joined: Thu Mar 26, 2009 3:32 pm

Advertisement

Re: 2 questions about rewrite rule?

Postby dcz » Wed Apr 22, 2009 12:33 pm

For the www prefix, just get rid of it in your phpBB server config in acp, server name should be :
Code: Select all
example.com

and while you'll be at it, make sure you've set your cookie domain to :
Code: Select all
.example.com

with the dot ("."), as it should always be the case, both with and without the www prefix.
Then, you should have a look to this : Locking the www in urls
to make sure that only one scenario (with or without the www) is actually used.

The Cyrillic char-set is a bit more complex, the first matter being I don't know much of it and I'm not really able to set up the proper replacement you could want, but they are all doable and pretty easily.
So if you provide with the replacement you would want, I can provide with the code ;)

Something like a list with both upper and lower cases, and duplicates (if several Cyrillic letter are to be replaced with the same latin one):
Code: Select all
A:a
Б:b
Cyrillic:latin

etc for all characters.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21378
Joined: Fri Apr 28, 2006 9:03 pm

Re: 2 questions about rewrite rule?

Postby akon » Sun Apr 26, 2009 3:20 am

3 year`s i support my board - 4 times i changed exactly that before in ACP, two days game with settings in this mod and never think about it - sorry for stupid question (Q1) and thank you for your support! :oops: :oops: :oops:

Q2 - ok - i know the letters, which and how needed to be changed (they are almost same with russian keyboard - differebce is only in one letter - Э - wich i dont know how to translate and for my case is unnecessary) anyway - for lower cases:

а - a

б - b

в - v

г - g

д - d

е - e

ж - j

з - z

и - i

й - y

к - k

л - l

м - m

н - n

о - o

п - p

р - r

с - s

т - t

у - u

ф - f

х - h

ц - c

ч - ch

ш - sh

щ - sht

ъ - a

ь - x

ю - yu

я - ya

And same for upper cases:

А - A

Б - B

В - V

Г - G

Д - D

Е - E

Ж - J

З - Z

И - I

Й - Y

К - K

Л - L

М - M

Н - N

О - O

П - P

Р - R

С - S

Т - T

У - U

Ф - F

Х - H

Ц - C

Ч - CH

Ш - SH

Щ - SHT

Ъ - A

Ь - X

Ю - YU

Я - YA

Note: This letter replacement is based on my personal observing on the google in search strings how google replace kyrillic alphabet itself and so i deside to use same. If anybody want to use differen please do it, don`t shoot on me. :)

And yes - some letters may be replaced on more of one way, but i don't need - will be happy to have code for this which to put it to .htaccess (or what is needed to do).

Note 2 I need replacement for this letters only for topic titles and to be replaced only in rewriten links - not in meta tags and not in topic texts or anything else.

Thank you (and beer). :)
akon
 
Posts: 8
Joined: Thu Mar 26, 2009 3:32 pm

Re: 2 questions about rewrite rule?

Postby dcz » Sun Apr 26, 2009 11:28 am

All right, so before you start, make sure you convert the phpbb_seo/phpbb_seo_class.php file to utf-8 without bom (using notepad++ for example). Then, save it and do the following :

Open phpbb_seo_class.php and find :
Code: Select all
      return;
   }

(the first time you see it, eg, just before the end of the constructor method phpbb_seo()).

Before add :
Code: Select all
      // Custom characters replacement
      $url_replace = array(
         'А' => 'A', 'а' => 'a',
         'Б' => 'B', 'б' => 'b',
         'В' => 'V', 'в' => 'v',
         'Г' => 'G', 'г' => 'g',
         'Д' => 'D', 'д' => 'd',
         'Е' => 'E', 'е' => 'e',
         'Ж' => 'J', 'ж' => 'j',
         'З' => 'Z', 'з' => 'z',
         'И' => 'I', 'и' => 'i',
         'Й' => 'Y', 'й' => 'y',
         'К' => 'K', 'к' => 'k',
         'Л' => 'L', 'л' => 'l',
         'М' => 'M', 'м' => 'm',
         'Н' => 'N', 'н' => 'n',
         'О' => 'O', 'о' => 'o',
         'П' => 'P', 'п' => 'p',
         'Р' => 'R', 'р' => 'r',
         'С' => 'S', 'с' => 's',
         'Т' => 'T', 'т' => 't',
         'У' => 'U', 'у' => 'u',
         'Ф' => 'F', 'ф' => 'f',
         'Х' => 'H', 'х' => 'h',
         'Ц' => 'C', 'ц' => 'c',
         'Ч' => 'CH', 'ч' => 'ch',
         'Ш' => 'SH', 'ш' => 'sh',
         'Щ' => 'SHT', 'щ' => 'sht',
         'Ъ' => 'A', 'ъ' => 'a',
         'Ь' => 'X', 'ь' => 'x',
         'Ю' => 'YU', 'ю' => 'yu',
         'Я' => 'YA','я' => 'ya',   
      );
      $this->seo_opt['url_find'] = array_keys($url_replace);
      $this->seo_opt['url_replace'] = array_values($url_replace);
      // Custom characters replacement


FInd :
Code: Select all
      $url = preg_replace('`\[.*\]`U','',$url);

After add :
Code: Select all
      $url = str_replace( $this->seo_opt['url_find'], $this->seo_opt['url_replace'], $url );


And it should do it as you wished ;)

But you should still try the code on a local / test server before anything else ;)

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21378
Joined: Fri Apr 28, 2006 9:03 pm

Re: Setup and cyrillic char-set

Postby akon » Sun Apr 26, 2009 10:20 pm

And is it - thank you - code work perfect (confirmed on 2 different phpBB 3.0.4 boards).

Best regards and thank you again!
akon
 
Posts: 8
Joined: Thu Mar 26, 2009 3:32 pm

Re: Setup and cyrillic char-set

Postby dcz » Fri May 01, 2009 12:10 pm

;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21378
Joined: Fri Apr 28, 2006 9:03 pm

Re: Setup and cyrillic char-set

Postby dcz » Fri Jun 12, 2009 8:07 am

Just in case you're wondering about how to update when you'll be doing it, read this : Custom replacement for title injection

The second post will make this very easy for you ;)
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21378
Joined: Fri Apr 28, 2006 9:03 pm

Re: 2 questions about rewrite rule?

Postby gorco » Thu Nov 08, 2012 2:39 am

dcz wrote:All right, so before you start, make sure you convert the phpbb_seo/phpbb_seo_class.php file to utf-8 without bom (using notepad++ for example). Then, save it and do the following :

Open phpbb_seo_class.php and find :
Code: Select all
      return;
   }

(the first time you see it, eg, just before the end of the constructor method phpbb_seo()).

Before add :
Code: Select all
      // Custom characters replacement
      $url_replace = array(
         'А' => 'A', 'а' => 'a',
         'Б' => 'B', 'б' => 'b',
         'В' => 'V', 'в' => 'v',
         'Г' => 'G', 'г' => 'g',
         'Д' => 'D', 'д' => 'd',
         'Е' => 'E', 'е' => 'e',
         'Ж' => 'J', 'ж' => 'j',
         'З' => 'Z', 'з' => 'z',
         'И' => 'I', 'и' => 'i',
         'Й' => 'Y', 'й' => 'y',
         'К' => 'K', 'к' => 'k',
         'Л' => 'L', 'л' => 'l',
         'М' => 'M', 'м' => 'm',
         'Н' => 'N', 'н' => 'n',
         'О' => 'O', 'о' => 'o',
         'П' => 'P', 'п' => 'p',
         'Р' => 'R', 'р' => 'r',
         'С' => 'S', 'с' => 's',
         'Т' => 'T', 'т' => 't',
         'У' => 'U', 'у' => 'u',
         'Ф' => 'F', 'ф' => 'f',
         'Х' => 'H', 'х' => 'h',
         'Ц' => 'C', 'ц' => 'c',
         'Ч' => 'CH', 'ч' => 'ch',
         'Ш' => 'SH', 'ш' => 'sh',
         'Щ' => 'SHT', 'щ' => 'sht',
         'Ъ' => 'A', 'ъ' => 'a',
         'Ь' => 'X', 'ь' => 'x',
         'Ю' => 'YU', 'ю' => 'yu',
         'Я' => 'YA','я' => 'ya',   
      );
      $this->seo_opt['url_find'] = array_keys($url_replace);
      $this->seo_opt['url_replace'] = array_values($url_replace);
      // Custom characters replacement


FInd :
Code: Select all
      $url = preg_replace('`\[.*\]`U','',$url);

After add :
Code: Select all
      $url = str_replace( $this->seo_opt['url_find'], $this->seo_opt['url_replace'], $url );


And it should do it as you wished ;)

But you should still try the code on a local / test server before anything else ;)

++



Hi dcz,

I was hoping that you might actually help me?

I'm using 3.0.11 version of PHPBB and Ultimate Seo v 0.7.0 SEO URL MOD.

Where exactly in the file phpbb_seo_class.php I should place the lines ? Because I was searching and there were no lines like you wrote to FIND.

Please advice ?
gorco
 
Posts: 6
Joined: Wed Nov 07, 2012 6:06 pm

Re: Setup and cyrillic char-set

Postby gorco » Thu Nov 08, 2012 3:13 am

Code: Select all
if ( $this->seo_opt['url_rewrite'] && !defined('ADMIN_START') && isset($this->file_hbase[$this->seo_opt['req_file']])) {
         $this->seo_opt['seo_base_href'] = '<base href="' . $this->file_hbase[$this->seo_opt['req_file']] . '"/>';
      }


It should go after this , and normaly before:

Code: Select all
return;
   }



Here's mine addition if anyone requires Macedonian Cyrillic letters (with included ex-Yugoslav (Serbian & Croatian) special Latin chars.

Code: Select all
// Custom characters replacement
           $url_replace = array(
             'А' => 'A', 'а' => 'a',
             'Б' => 'B', 'б' => 'b',
             'В' => 'V', 'в' => 'v',
             'Г' => 'G', 'г' => 'g',
             'Д' => 'D', 'д' => 'd',
             'Ѓ' => 'Gj', 'ѓ' => 'gj',
             'Е' => 'E', 'е' => 'e',
             'Ж' => 'Zh', 'ж' => 'zh',
             'З' => 'Z', 'з' => 'z',
             'Ѕ' => 'Dz', 'ѕ' => 'dz',
             'И' => 'I', 'и' => 'i',
             'Ј' => 'j', 'ј' => 'j',
             'К' => 'K', 'к' => 'k',
             'Л' => 'L', 'л' => 'l',
             'Љ' => 'Lj', 'љ' => 'lj',
             'М' => 'M', 'м' => 'm',
             'Н' => 'N', 'н' => 'n',
             'Њ' => 'Nj', 'њ' => 'nj',
             'О' => 'O', 'о' => 'o',
             'П' => 'P', 'п' => 'p',
             'Р' => 'R', 'р' => 'r',
             'С' => 'S', 'с' => 's',
             'Т' => 'T', 'т' => 't',
             'Ќ' => 'Kj', 'ќ' => 'kj',
             'У' => 'U', 'у' => 'u',
             'Ф' => 'F', 'ф' => 'f',
             'Х' => 'H', 'х' => 'h',
             'Ц' => 'C', 'ц' => 'c',
             'Ч' => 'Ch', 'ч' => 'ch',
             'Џ' => 'Dj', 'џ' => 'dj',
             'Ш' => 'Sh', 'ш' => 'sh',
             'Đ' => 'Dj', 'đ' => 'dj',
             'Š' => 'Sh', 'š' => 'sh',
             'Č' => 'Ch', 'č' => 'ch',
             'Ć' => 'C', 'ć' => 'c',
             'Ž' => 'Zh', 'ž' => 'zh',
           );
           $this->seo_opt['url_find'] = array_keys($url_replace);
           $this->seo_opt['url_replace'] = array_values($url_replace);
           // Custom characters replacement
gorco
 
Posts: 6
Joined: Wed Nov 07, 2012 6:06 pm


Return to phpBB mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: AhrefsBot [Bot] and 4 guests


 
cron