Clean URLs

Please post answers on the most frequently asked questions about CMSimple
cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Fri Jun 06, 2014 7:12 pm

Maxim wrote:Proposes changes to the .htaccess file. URLs without www.
Indeed, that is a good suggestion. See also http://www.cmsimple-xh.org/wiki/doku.ph ... te_content.
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

У меня уже очень большие Uri

Post by Maxim » Fri Jun 20, 2014 10:12 am

[ external image ] Здравствуйте.

У меня уже очень большие Uri ("new" и "org"):

Code: Select all

$tx['urichar']['new']="a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|А|Б|В|Г|Д|Е|Ё|Ж|З|І|Ї|И|Ы|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ы|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Хочу убрать большие буквы, а маленькие оставить и чтобы в адресе были только маленькие буквы.

Не всем это может понравится, поэтому хочется в настройках иметь возможность выбора:
  • Только маленькие буквы (строчные)
  • Большие и маленькие (ПРОПИСНЫЕ и строчные)
[ external image ] Guten Tag.

Ich habe bereits eine sehr große Uri ("new" und "org"):

Code: Select all

$tx['urichar']['new']="a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|А|Б|В|Г|Д|Е|Ё|Ж|З|І|Ї|И|Ы|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ы|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Möchte entfernen großen Buchstaben, und die kleinen verlassen, um in die Adresse, waren nur kleine Buchstaben.

Nicht alle mögen, deshalb möchte ich in den Einstellungen die Möglichkeit der Wahl:
  • Nur kleine Buchstaben (groß -)
  • Große und kleine (GROß-und Kleinschreibung)
[ external image ] Hello.

I have a very large Uri ("new" and "org"):

Code: Select all

$tx['urichar']['new']="a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|А|Б|В|Г|Д|Е|Ё|Ж|З|І|Ї|И|Ы|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ы|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";-|Y|E|b|e|\"|(|)|,|.";
I want to remove large letters, and small to leave and to address were only small letters.

Not everyone is going to like, so you want the settings to have a choice:
  • Only small letters (lowercase)
  • Large and small (UPPERCASE and lowercase)
Simple Hosting
Бедная, бросаемая бурею, безутешная!

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Fri Jun 20, 2014 5:44 pm

Maxim wrote:У меня уже очень большие Uri ("new" и "org"):
[ code ]
Indeed, that is very large! Long time ago I have presented a small add-on, which should handle many of the urichar_org/new possibilities automatically for languages using Roman characters, but unfortunately not for languages using Cyrillic characters (as well as others).

So, as I already noted in the other thread, there is the need for a better transliteration function/library. iconv() offers a //TRANSLIT option, but that doesn't seem to work as expected ('ä' => 'a'). Since version 5.4 PHP offers a Transliteration class, but this is not well documented, and I don't know how to use it. However, now I have found https://github.com/jbroadway/urlify, which seems to do the job. I will update the recipe in the other thread as soon as possible.
Maxim wrote:Не всем это может понравится, поэтому хочется в настройках иметь возможность выбора:
  • Только маленькие буквы (строчные)
  • Большие и маленькие (ПРОПИСНЫЕ и строчные)
Find function XH_uenc() in cmsimple/functions.php and it replace it with the following:

Code: Select all

function XH_uenc($s, $search, $replace)
{
    global $cf;

    $s = str_replace($search, $replace, $s);
    $s = str_replace('+', $cf['uri']['word_separator'], urlencode($s));
    if ($cf['uri']['lowercase']) {
        return utf8_strtolower($s);
    } else {
        return $s;
    }
}
Then add the following line to cmsimple/config.php:

Code: Select all

$cf['uri']['lowercase']="true";
For CMSimple_XH 1.6+, you should add the following line to cmsimple/metaconfig.php also:

Code: Select all

$mcf['uri']['lowercase']="bool";
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

Пroverka.html

Post by Maxim » Mon Jun 23, 2014 6:12 am

[ external image ] Доброе утро.

Не получилось:
Если URI:

Code: Select all

$tx['urichar']['new']="a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
И создаю страницу:
Проверка

У ссылки такой вид:
/Пroverka.html

[ external image ] Guten morgen.

Hat nicht funktioniert:
Wenn URI:

Code: Select all

$tx['urichar']['new']="a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Und erstelle die Seite:
Проверка

Bei den Links so Aussehen:
/Пroverka.html

[ external image ] Good morning.

Failed:
If the URI:

Code: Select all

$tx['urichar']['new']="a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Create page:
Проверка

The links like this:
/Пroverka.html
Simple Hosting
Бедная, бросаемая бурею, безутешная!

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Mon Jun 23, 2014 10:32 am

Maxim wrote:Не получилось:
Если URI:
The solution was meant to work with your former urichar_org/new. You need to have the replacements for upper-case letters there, to cater for $cf['uri']['lowercase']="".
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

Не могу понять, (перевести)

Post by Maxim » Mon Jun 23, 2014 11:24 am

[ external image ] Не могу понять, (перевести). Можете показать пример в тегах CODE?
[ external image ] Ich kann nicht verstehen, (übersetzen). Können Sie mit gutem Beispiel mit den Tags CODE?
[ external image ] Can't understand (translate). Can you show an example in tags CODE?
Simple Hosting
Бедная, бросаемая бурею, безутешная!

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Mon Jun 23, 2014 11:57 am

Maxim wrote:Не могу понять, (перевести). Можете показать пример в тегах CODE?
Unfortunately, you have to stick with:

Code: Select all

$tx['urichar']['new']="a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|А|Б|В|Г|Д|Е|Ё|Ж|З|І|Ї|И|Ы|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ы|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

А что изменилось? Не получилось наверно.

Post by Maxim » Mon Jun 23, 2014 12:10 pm

Unfortunately, you have to stick with:
[ external image ]

Code: Select all

$cf['uri']['lowercase']="true";
- добавил в config.php

А что изменилось? Uri так и остались большими.
Не получилось наверно.

[ external image ]

Code: Select all

$cf['uri']['lowercase']="true";
- Hinzugefügt config.php

Und was hat sich geändert? Uri und so blieben die großen.
Nicht geklappt hat wahrscheinlich.

[ external image ]

Code: Select all

$cf['uri']['lowercase']="true";
- added in the config.php

And what has changed? Uri has remained large.
Did not work I guess.
Simple Hosting
Бедная, бросаемая бурею, безутешная!

cmb
Posts: 13273
Joined: Tue Jun 21, 2011 11:04 am
Location: Mü-Sa, RLP, DE
Contact:

Re: Clean URLs

Post by cmb » Mon Jun 23, 2014 12:55 pm

Sorry, I have posted wrong urichar_org/new. Please try the following:

Code: Select all

$tx['urichar']['new']="A|B|V|G|D|E|Yo|Zh|Z|I|Y|K|L|M|N|O|P|R|S|T|U|F|H|C|Ch|Sh|Sch|Tz|Y|Mz|E|Yu|Ya|a|b|v|g|d|e|yo|zh|z|i|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|tz|y|mz|e|yu|ya";
$tx['urichar']['org']="А|Б|В|Г|Д|Е|Ё|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ъ|Ы|Ь|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ъ|ы|ь|э|ю|я";
Christoph M. Becker – Plugins for CMSimple_XH

Maxim
Posts: 121
Joined: Thu Jun 13, 2013 6:52 am
Location: Запорожье
Contact:

Да так буквы маленькие, но количество замен...

Post by Maxim » Mon Jun 23, 2014 1:29 pm

[ external image ] Да так буквы маленькие, но количество замен (букв) в Uri не поменялось.

Из

Code: Select all

$tx['urichar']['new']="A|B|V|G|D|E|Yo|Zh|Z|I|Y|K|L|M|N|O|P|R|S|T|U|F|H|C|Ch|Sh|Sch|Tz|Y|Mz|E|Yu|Ya|a|b|v|g|d|e|yo|zh|z|i|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|tz|y|mz|e|yu|ya";
$tx['urichar']['org']="А|Б|В|Г|Д|Е|Ё|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ъ|Ы|Ь|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ъ|ы|ь|э|ю|я";
Хочу такой Uri

Code: Select all

$tx['urichar']['new']="a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Не хочу дублировать одни и те же буквы.

[ external image ] Ja so Kleinbuchstaben, sondern die Anzahl der Ersetzungen (Buchstaben) in der Uri nicht geändert.

Aus

Code: Select all

$tx['urichar']['new']="A|B|V|G|D|E|Yo|Zh|Z|I|Y|K|L|M|N|O|P|R|S|T|U|F|H|C|Ch|Sh|Sch|Tz|Y|Mz|E|Yu|Ya|a|b|v|g|d|e|yo|zh|z|i|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|tz|y|mz|e|yu|ya";
$tx['urichar']['org']="А|Б|В|Г|Д|Е|Ё|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ъ|Ы|Ь|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ъ|ы|ь|э|ю|я";
Ich möchte diese Uri

Code: Select all

$tx['urichar']['new']="a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Ich will nicht duplizieren dieselben Buchstaben.

[ external image ] So the letters are small, but the number of substitutions (letters) in the Uri has not changed.

From

Code: Select all

$tx['urichar']['new']="A|B|V|G|D|E|Yo|Zh|Z|I|Y|K|L|M|N|O|P|R|S|T|U|F|H|C|Ch|Sh|Sch|Tz|Y|Mz|E|Yu|Ya|a|b|v|g|d|e|yo|zh|z|i|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|tz|y|mz|e|yu|ya";
$tx['urichar']['org']="А|Б|В|Г|Д|Е|Ё|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ъ|Ы|Ь|Э|Ю|Я|а|б|в|г|д|е|ё|ж|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ъ|ы|ь|э|ю|я";
I want this Uri

Code: Select all

$tx['urichar']['new']="a|b|v|g|d|e|yo|zh|z|i|i|i|y|y|k|l|m|n|o|p|r|s|t|u|f|h|c|ch|sh|sch|y|e|yu|ya|and";
$tx['urichar']['org']="а|б|в|г|д|е|ё|ж|з|і|ї|и|ы|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ы|э|ю|я|&|№|+| –| -|Ъ|Ь|ъ|ь|\"|(|)|,|.";
Don't want to duplicate the same letter.
Simple Hosting
Бедная, бросаемая бурею, безутешная!

Post Reply