Clean URL
Clean URL
Hallo.
Zeigen Sie, wie Sie erstellen Clean URL?
Von:
http://mysite.com/?Test_1___Test_2___Test_3
Erstellen:
http://mysite.com/Test_1/Test_2/Test_3.html
Vielen Dank.
Hello.
Tell me how to create a Friendly URL?
From:
http://mysite.com/?Test_1___Test_2___Test_3
Create:
http://mysite.com/Test_1/Test_2/Test_3.html
Thanks.
Здравствуйте.
Подскажите, как создать ЧПУ (Человекопонятный URL)
Из:
http://mysite.com/?Test_1___Test_2___Test_3
Создать:
http://mysite.com/Test_1/Test_2/Test_3.html
Спасибо.
Бедная, бросаемая бурею, безутешная!
Re: Clean URL
eine "Clean URL" Funktion gibt es nicht bei CMSimple. Wozu auch?
"mysite.com/?Test_1___Test_2___Test_3" ist genauso gut wie "mysite.com/Test_1/Test_2/Test_3.html", sowohl für Menschen als auch für Suchmaschinen.
Es ist nicht notwendig und auch nicht geplant.
Du kannst aber in der Konfiguration unter URI => Seperator das "___" gegen ein "/" austauschen. Dann funktionieren aber manche Links (z. B. von facebook) nicht mehr. Deshalb habe ich "___" als Trenner eingeführt,
Gert
Traurig
Traurig.Es ist nicht geplant
Über "Seperator" - ich weiß.
Sadly.It is not planned
About "Seperator" - i know.
Печально.Не планируется
Про "Seperator" - знаю.
Бедная, бросаемая бурею, безутешная!
Re: Clean URL
МаксимЕсть способ, чтобы был "человекопонятный урл":
http://cmsimpleforum.com/viewtopic.php?f=4&t=5719
Вы можете увидеть его в действии:
http://www.waschitza.de/
Original:
Здравствуйте.
Спасибо, про этот адрес я знаю, он у меня здесь:
http://maxim.zp.ua/forum/thread10.html
Но:
1. У этой модификации нет - ".html":
http://mysite.com/Test_1/Test_2/Test_3.html
2. Это ведь модификация, а не сразу от разработчика и нужно после каждого обновления делать корректировки и немало, а Герт быстрый - обновления выходят часто.
Hello.
Thank you, about this link I know, I have it here:
http://maxim.zp.ua/forum/thread10.html
But:
1. With this modification, no - ".html":
http://mysite.com/Test_1/Test_2/Test_3.html
2. This is a modification, rather than directly from the developer and need after each update do the adjustments and a lot, and Gert fast - updates come out often.
http://maxim.zp.ua/forum/thread9-1.html
Бедная, бросаемая бурею, безутешная!
Re: Clean URL
please discuss it with Christoph in the CMSimple_XH forum:
http://cmsimpleforum.com
"Clean URLs" are not on the roadmap of CMSimple,
Gert
Re: Clean URL
Ладно, вероятно вы не дружите.
Okay, you probably do not be friends.
Бедная, бросаемая бурею, безутешная!
Re: Clean URL
Так подружитесь.
Дружба лучше чем вражда.
Хотя и не всегда.
So make friends.
Friendship is better than hostility.
Although not always.
Бедная, бросаемая бурею, безутешная!
Re: Clean URL
Создал сбору "CMSimple_42_CleanURLs" и обновление "Update_CMSimple_42_CleanURLs"
http://maxim.zp.ua/users/2/files.html
Hello.
Created collection "CMSimple_42_CleanURLs" and update "Update_CMSimple_42_CleanURLs"
http://maxim.zp.ua/users/2/files.html
Бедная, бросаемая бурею, безутешная!
Чтоб не потерять, размещу здесь
3-я строка
Code: Select all
/*
==================================================
File modified by addon CleanURLs for CMSimple
Released: 2013-08-01
URL: http://maxim.zp.ua/users/2/files.html
==================================================
*/
// Original System Info:
70-я строка
Code: Select all
// version-informations
define('CMSIMPLE_XH_VERSION', 'CMSimple 4.2.2 with CleanURLs Addon'); //for compatibility CMSimple_XH
define('CMSIMPLE_XH_BUILD', 2013080101); //for compatibility CMSimple_XH
define('CMSIMPLE_XH_DATE', '2013-08-01'); //for compatibility CMSimple_XH
define('CMSIMPLE_VERSION', 'CMSimple 4.2.2 with CleanURLs Addon');
define('CMSIMPLE_RELEASE', 2013080101);
define('CMSIMPLE_DATE', '2013-08-01');
define('CMSIMPLE_VERSIONSINFO', 'http://www.cmsimple.org/downloads_cmsimple40/versioninfo/version.nfo');
//END version-informations
Code: Select all
// version-informations
define('CMSIMPLE_XH_VERSION', 'CMSimple 4.2.2'); //for compatibility CMSimple_XH
define('CMSIMPLE_XH_BUILD', 2013071201); //for compatibility CMSimple_XH
define('CMSIMPLE_XH_DATE', '2013-07-12'); //for compatibility CMSimple_XH
define('CMSIMPLE_VERSION', 'CMSimple 4.2.2');
define('CMSIMPLE_RELEASE', 2013071201);
define('CMSIMPLE_DATE', '2013-07-12');
define('CMSIMPLE_VERSIONSINFO', 'http://www.cmsimple.org/downloads_cmsimple40/versioninfo/version.nfo');
//END version-informations
cmsimple/cms.php
123-я строка
Code: Select all
$subsite_folder = str_replace(CMSIMPLE_ROOT, '', $_SERVER['SCRIPT_NAME']);
Code: Select all
$subsite_folder = str_replace(CMSIMPLE_ROOT, '', $_SERVER['SCRIPT_NAME']);
251-я строка
Code: Select all
$sn = preg_replace('/index.php$/', '', $_SERVER['SCRIPT_NAME']);
Code: Select all
$sn = preg_replace('/([^\?]*)\?.*/', '\1', sv(($iis ? 'SCRIPT_NAME' : 'REQUEST_URI')));
275-я строка
Code: Select all
$su = substr($su, 0, $cf['uri']['length']);
foreach (array('login', 'mailform', 'print', 'sitemap') as $i) {
if (!empty($GLOBALS[uenc($tx['menu'][$i])])) {
$$i = 'true';
}
}
Code: Select all
$su = substr($su, 0, $cf['uri']['length']);
cmsimple/cms.php
485-я строка
Code: Select all
<p><b>URL:</b> <a href="' . $sn . '' . str_replace('&print','',$_SERVER['QUERY_STRING']) . '.html">' . $_SERVER['SERVER_NAME'] . $sn . '' . str_replace('&print','',$_SERVER['QUERY_STRING']) . '.html</a></p>
Code: Select all
<p><b>URL:</b> <a href="' . $sn . '?' . str_replace('&print','',$_SERVER['QUERY_STRING']) . '">' . $_SERVER['SERVER_NAME'] . $sn . '?' . str_replace('&print','',$_SERVER['QUERY_STRING']) . '</a></p>
565-я строка
Code: Select all
function a($i, $x)
{
global $sn, $u, $cf, $adm;
if ($i == 0 && !$adm) {
if ($x == '' && $cf['locator']['show_homepage'] == 'true')
{
return '<a href="' . $sn . $u[0] . '.html">';
}
}
return isset($u[$i]) ? '<a href="' . $sn . $u[$i] . '.html' . (!empty($x) ? '?' . $x : '') . '">' : '<a href="' . $sn . '.html' . (!empty($x) ? '?' . $x : '') . '">';
}
Code: Select all
function a($i, $x)
{
global $sn, $u, $cf, $adm;
if ($i == 0 && !$adm) {
if ($x == '' && $cf['locator']['show_homepage'] == 'true')
{
return '<a href="' . $sn . '?' . $u[0] . '">';
}
}
return isset($u[$i]) ? '<a href="' . $sn . '?' . $u[$i] . $x . '">' : '<a href="' . $sn . '?' . $x . '">';
}
585-я строка
Code: Select all
function ml($i)
{
global $f, $sn, $tx;
$t = '';
if ($f != $i)
$t .= '<a href="' . $sn . '' . uenc($tx['menu'][$i]) . '.html">';
$t .= $tx['menu'][$i];
if ($f != $i)
$t .= '</a>';
return $t;
}
Code: Select all
function ml($i)
{
global $f, $sn, $tx;
$t = '';
if ($f != $i)
$t .= '<a href="' . $sn . '?' . amp() . $i . '">';
$t .= $tx['menu'][$i];
if ($f != $i)
$t .= '</a>';
return $t;
}
cmsimple/functions.php
597-я строка
Code: Select all
function uenc($s)
{
global $tx;
if (isset($tx['urichar']['org']) && isset($tx['urichar']['new']))
$s = str_replace(explode(",", $tx['urichar']['org']), explode(",", $tx['urichar']['new']), $s);
$s = str_replace(',', '', $s); // this is the new line
return str_replace('+', '-', urlencode($s)); // here the space is replaced
}
Code: Select all
function uenc($s)
{
global $tx;
if (isset($tx['urichar']['org']) && isset($tx['urichar']['new']))
$s = str_replace(explode(",", $tx['urichar']['org']), explode(",", $tx['urichar']['new']), $s);
return str_replace('+', '_', urlencode($s));
}
cmsimple/functions.php
814-я строка
Code: Select all
function head()
{
global $title, $cf, $pth, $tx, $sn, $hjs;
$t = htmlspecialchars($cf['site']['title'], ENT_COMPAT, 'UTF-8');
if (!empty($t) && !empty($title))
{
$t .= ' - ';
}
$t .= $title;
$t = '<title>' . strip_tags($t) . '</title>' . "\n";
foreach ($cf['meta'] as $i => $k)
{
$t .= meta($i);
}
if(file_exists('./favicon.ico'))
{
$t.=tag('link rel="shortcut icon" type="image/x-icon" href="' . $sn . 'favicon.ico"') . "\n";
}
$t = tag('meta http-equiv="content-type" content="text/html; charset=utf-8"') . "\n" . $t;
global $sn;
$t .= tag('base href="http'
. (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '')
. '://' . $_SERVER['SERVER_NAME']
. ($_SERVER['SERVER_PORT'] < 1024 ? '' : ':' . $_SERVER['SERVER_PORT'])
. $sn . '"') . "\n";
return $t . tag('meta name="generator" content="' . CMSIMPLE_VERSION . ' ' . CMSIMPLE_RELEASE . ' - www.cmsimple.org"') . "\n" . tag('link rel="stylesheet" href="' . $pth['file']['corestyle'] . '" type="text/css"') . "\n" . tag('link rel="stylesheet" href="' . $pth['file']['stylesheet'] . '" type="text/css"') . "\n" . $hjs;
}
Code: Select all
function head()
{
global $title, $cf, $pth, $tx, $sn, $hjs;
$t = htmlspecialchars($cf['site']['title'], ENT_COMPAT, 'UTF-8');
if (!empty($t) && !empty($title))
{
$t .= ' - ';
}
$t .= $title;
$t = '<title>' . strip_tags($t) . '</title>' . "\n";
foreach ($cf['meta'] as $i => $k)
{
$t .= meta($i);
}
if(file_exists('./favicon.ico'))
{
$t.=tag('link rel="shortcut icon" type="image/x-icon" href="' . $sn . 'favicon.ico"') . "\n";
}
$t = tag('meta http-equiv="content-type" content="text/html; charset=utf-8"') . "\n" . $t;
return $t . tag('meta name="generator" content="' . CMSIMPLE_VERSION . ' ' . CMSIMPLE_RELEASE . ' - www.cmsimple.org"') . "\n" . tag('link rel="stylesheet" href="' . $pth['file']['corestyle'] . '" type="text/css"') . "\n" . tag('link rel="stylesheet" href="' . $pth['file']['stylesheet'] . '" type="text/css"') . "\n" . $hjs;
}
cmsimple/functions.php
1067-я строка
Code: Select all
function printlink()
{
global $f, $search, $file, $sn, $tx, $adm;
$t = amp() . uenc($tx['menu']['print']);
if ($f == 'search')
$t .= amp() . 'function=search' . amp() . 'search=' . htmlspecialchars(stsl($search), ENT_COMPAT, 'UTF-8');
else if ($f == 'file')
$t .= amp() . 'file=' . $file;
else if ($f != '' && $f != 'save')
$t .= amp() . $f;
else if (sv('QUERY_STRING') != '')
$t = htmlspecialchars(sv('QUERY_STRING'), ENT_COMPAT, "UTF-8") . $t;
return '<a href="' . $sn . '' . $t . '.html" target="_blank">' . $tx['menu']['print'] . '</a>';
}
Code: Select all
function printlink()
{
global $f, $search, $file, $sn, $tx, $adm;
$t = amp() . 'print';
if ($f == 'search')
$t .= amp() . 'function=search' . amp() . 'search=' . htmlspecialchars(stsl($search), ENT_COMPAT, 'UTF-8');
else if ($f == 'file')
$t .= amp() . 'file=' . $file;
else if ($f != '' && $f != 'save')
$t .= amp() . $f;
else if (sv('QUERY_STRING') != '')
$t = htmlspecialchars(sv('QUERY_STRING'), ENT_COMPAT, "UTF-8") . $t;
return '<a href="' . $sn . '?' . $t . '">' . $tx['menu']['print'] . '</a>';
}
1221-я строка
Code: Select all
$t .= '<li>' . a($s, $changeMode) . $changeText . '</a></li>' . "\n";
Code: Select all
$t .= '<li><a href="' . $sn . '?' . $su . '&' . $changeMode . '">' . $changeText . '</a></li>' . "\n";
cmsimplexh/cmsimple/userfuncs.php
Code: Select all
<?php
/**
* Returns the canonical link tag. Works only for clean URLs.
*
* @global string The absolute path to the directory of the folder which contains index.php.
* @global string The GET parameter of the current page.
* @global array The GET parameters of all pages.
* @param array $ignoreParams The paramaters to ignore in the canonical URL (e.g. print).
* @return string The (X)HTML.
*/
function canonical($ignoreParams = array())
{
global $sn, $su, $u;
$params = array();
$allParams = explode('&', $_SERVER['QUERY_STRING']);
foreach ($allParams as $param) {
$param = explode('=', $param);
$key = $param[0];
if ($key != $su && !in_array($key, $ignoreParams)) {
$params[$key] = isset($param[1]) ? $param[1] : null;
}
}
ksort($params);
$newParams = array();
foreach ($params as $key => $value) {
$newParams[] = $key . (isset($value) ? "=$value" : '');
}
$baseURL = 'http'
. (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '')
. '://' . $_SERVER['SERVER_NAME']
. ($_SERVER['SERVER_PORT'] < 1024 ? '' : ':' . $_SERVER['SERVER_PORT'])
. $sn;
$canonicalSU = $su == $u[0] ? '' : $su;
$url = $baseURL . $canonicalSU;
if (!empty($newParams)) {
$url .= '?' . (empty($canonicalSU) ? '&' : '')
. implode('&', $newParams);
}
$link = tag('link rel="canonical" href="'
. htmlspecialchars($url, ENT_COMPAT, 'UTF-8') . '"') . "\n";
return $link;
}
/*
* Insert the canonical link to the "head" element, when not in admin mode.
*/
if (!$adm) {
$hjs .= canonical(array('logout', 'print'));
}
?>
3-я строка
Code: Select all
// General options
document_base_url: "%BASE_URL%",
theme : "advanced",
Code: Select all
// General options
theme : "advanced",
plugins/tinymce/inits (init_coauthorsminimal.js, init_coauthorssidebar.js, init_minimal.js, init_sidebar.js)
3-я строка
Code: Select all
// General options
document_base_url: "%BASE_URL%",
mode : "specific_textareas",
Code: Select all
// General options
mode : "specific_textareas",
"<?php echo loginlink();?>" на "<a href="http://vitalij.maxim.zp.ua/login.html">Вход</a>"
С картинками тоже не захотел разбираться поэтому в "content.htm" заменил:
"./userfiles/images/" на "http://vitalij.maxim.zp.ua//userfiles/images/"
"./?download=" на "http://vitalij.maxim.zp.ua/userfiles/downloads/"
(Пишу приблизительно, точно уже не помню)
cmsimple/login.php
73-я строка
Code: Select all
function lilink() // not in use anymore - fallback only
{
global $cf, $adm, $sn, $u, $s, $tx;
if (!$adm)
{
if ($cf['security']['type'] == 'javascript')
return '<a href="javascript:login()">' . $tx['menu']['login'] . '</a><form id="login" style="display: inline; display: none;" action="' . $sn . '" method="post">' . tag('input type="hidden" name="login" value="true"') . tag('input type="hidden" name="selected" value="' . $u[$s] . '"') . tag('input type="hidden" name="passwd" id="passwd" value=""') . '</form>';
else
return a($s > -1 ? $s : 0, uenc($tx['menu']['login'])) . $tx['menu']['login'] . '</a>';
}
}
Code: Select all
function lilink() // not in use anymore - fallback only
{
global $cf, $adm, $sn, $u, $s, $tx;
if (!$adm)
{
if ($cf['security']['type'] == 'javascript')
return '<a href="javascript:login()">' . $tx['menu']['login'] . '</a><form id="login" style="display: inline; display: none;" action="' . $sn . '" method="post">' . tag('input type="hidden" name="login" value="true"') . tag('input type="hidden" name="selected" value="' . $u[$s] . '"') . tag('input type="hidden" name="passwd" id="passwd" value=""') . '</form>';
else
return a($s > -1 ? $s : 0, '&login') . $tx['menu']['login'] . '</a>';
}
}
cmsimple/config.php
54-я строка
Code: Select all
$cf['uri']['seperator']="/";
Code: Select all
$cf['uri']['seperator']="___";
cmsimple/defaultconfig.php
54-я строка
Code: Select all
$cf['uri']['seperator']="/";
Code: Select all
$cf['uri']['seperator']=":";
318-я строка
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,Y,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,y,e,yu,ya,and";
$tx['urichar']['org']="А,Б,В,Г,Д,Е,Ё,Ж,З,И,Й,К,Л,М,Н,О,П,Р,С,Т,У,Ф,Х,Ц,Ч,Ш,Щ,Ы,Э,Ю,Я,а,б,в,г,д,е,ё,ж,з,и,й,к,л,м,н,о,п,р,с,т,у,ф,х,ц,ч,ш,щ,ы,э,ю,я,&, -,.,+,Ъ,Ь,ъ,ь,",(,)";
Code: Select all
$tx['urichar']['new']="";
$tx['urichar']['org']="";
19-я строка
Code: Select all
$tx['adminmenu']['media']="Медиа";
Code: Select all
$tx['title']['media']="Медиафайлы";
Code: Select all
$tx['sysinfo']['version_info']="Версия и информация об обновлении »";
Code: Select all
$tx['version']['cmsimple_ok']="Версия CMSimple актуальна.";
$tx['version']['current_version_installed']="Установлена актуальная версия";
$tx['version']['info_download']="Информация и загрузка";
$tx['version']['no_versionsinfo']="Информация о версии не доступна";
$tx['version']['standard_plugin']="Стандартный системный плагин";
$tx['version']['update_available']="Доступна новая версия";
$tx['version']['updates_message']="Доступно обновление";
$tx['version']['version_check_failed']="Проверка версии не удалась!";
Code: Select all
$tx['adminmenu']['media']="Media";
Code: Select all
$tx['title']['media']="Media файлы";
Code: Select all
$tx['sysinfo']['version_info']="Version- and Update Info »";
Code: Select all
$tx['version']['cmsimple_ok']="Current CMSimple version is installed.";
$tx['version']['current_version_installed']="Current version installed";
$tx['version']['info_download']="Info and download";
$tx['version']['no_versionsinfo']="No version informations available";
$tx['version']['standard_plugin']="Standard System Plugin";
$tx['version']['update_available']="Newer version is available";
$tx['version']['updates_message']="Updates available";
$tx['version']['version_check_failed']="Version check failed!";
318-я строка
Code: Select all
$tx['urichar']['new']="ae,oe,ue,Ae,Oe,Ue,ss,and";
$tx['urichar']['org']="ä,ö,ü,Ä,Ö,Ü,ß,&, -,.,+,",(,)";
Code: Select all
$tx['urichar']['new']="ae,oe,ue,Ae,Oe,Ue,ss";
$tx['urichar']['org']="ä,ö,ü,Ä,Ö,Ü,ß";
318-я строка
Code: Select all
$tx['urichar']['new']="and";
$tx['urichar']['org']="&, -,.,+,",(,)";
Code: Select all
$tx['urichar']['new']="";
$tx['urichar']['org']="";
Code: Select all
AddDefaultCharset UTF-8
RewriteEngine on
# Do not rewrite requests to existing directories and files:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Everything else is a CMSimple_XH page request,
# so shift the subfolders to the beginning of the query string
RewriteRule ^([A-z]{2}/)?([^.]*)(.html)?$ $1?$2 [QSA]
Code: Select all
AddDefaultCharset UTF-8
Бедная, бросаемая бурею, безутешная!