Korogodin/Настройка pretty URL — различия между версиями
Материал из SRNS
Korogodin (обсуждение | вклад) (Отмена правки 78 участника Korogodin (обсуждение)) |
Korogodin (обсуждение | вклад) (Отмена правки 77 участника Korogodin (обсуждение)) |
||
Строка 5: | Строка 5: | ||
В LocalSettings.php: | В LocalSettings.php: | ||
− | < | + | <source lang="php"> |
+ | ## The URL base path to the directory containing the wiki; | ||
## defaults for all runtime URL paths are based off of this. | ## defaults for all runtime URL paths are based off of this. | ||
## For more information on customizing the URLs please see: | ## For more information on customizing the URLs please see: | ||
Строка 11: | Строка 12: | ||
$wgScriptPath = ""; | $wgScriptPath = ""; | ||
$wgArticlePath = "/wiki/$1"; | $wgArticlePath = "/wiki/$1"; | ||
− | $wgUsePathInfo = true;</ | + | $wgUsePathInfo = true; |
+ | </source> | ||
'''Второе''' | '''Второе''' | ||
Строка 17: | Строка 19: | ||
В той же папке в .htaccess добавлено в конец: | В той же папке в .htaccess добавлено в конец: | ||
− | < | + | <source lang="apache"> |
+ | RewriteEngine On | ||
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [PT,L,QSA] | RewriteRule ^wiki/(.*)$ /index.php?title=$1 [PT,L,QSA] | ||
− | RewriteRule ^wiki/*$ /index.php [L,QSA]</ | + | RewriteRule ^wiki/*$ /index.php [L,QSA] |
− | + | </source> | |
{{wl-publish: 2011-04-02 12:32:11 +0400 | Korogodin }} | {{wl-publish: 2011-04-02 12:32:11 +0400 | Korogodin }} |
Текущая версия на 17:06, 2 апреля 2011
Задача решена в два действия. --more-- Первое:
В LocalSettings.php:
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;
Второе
В той же папке в .htaccess добавлено в конец:
RewriteEngine On
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ /index.php [L,QSA]
RewriteRule ^wiki/(.*)$ /index.php?title=$1 [PT,L,QSA]
RewriteRule ^wiki/*$ /index.php [L,QSA]