Korogodin/Настройка pretty URL — различия между версиями
Материал из SRNS
Korogodin (обсуждение | вклад) (Новая страница: «Задача решена в два действия. '''Первое:''' В LocalSettings.php: ## The URL base path to the directory containing the wiki; ## defa...») |
Korogodin (обсуждение | вклад) |
||
Строка 5: | Строка 5: | ||
В LocalSettings.php: | В LocalSettings.php: | ||
+ | <source lang="php"> | ||
## The URL base path to the directory containing the wiki; | ## 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. | ||
Строка 12: | Строка 13: | ||
$wgArticlePath = "/wiki/$1"; | $wgArticlePath = "/wiki/$1"; | ||
$wgUsePathInfo = true; | $wgUsePathInfo = true; | ||
+ | </source> | ||
'''Второе''' | '''Второе''' | ||
Строка 17: | Строка 19: | ||
В той же папке в .htaccess добавлено в конец: | В той же папке в .htaccess добавлено в конец: | ||
+ | <source lang="apache"> | ||
RewriteEngine On | 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 }} |
Версия 12:39, 2 апреля 2011
Задача решена в два действия.
Первое:
В 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]