Manual:$wgActionPaths/ko

This page is a translated version of the page Manual:$wgActionPaths and the translation is 12% complete.
Server URLs and file paths: $wgActionPaths
가변 사용자 동작을 위한 경로. URL을 좀 더 명확하게 만들기 위해 사용됩니다.
이 변수가 소개된 버전:1.5.0 (r7538)
이 변수가 사라진 버전:계속해서 쓰이고 있음
허용값:미지정
기본값:[]

자세히 보기

매뉴얼:Short URL 을 설정하고, 그게 정상 동작하는지 먼저 확인하고 따라하세요.

'명확한' URL 경로들을 일반 페이지 뷰가 아닌 동작을 위해 지정하려면 이 배열에 추가하세요.

For instance:

$wgActionPaths['edit'] = "$wgScriptPath/edit/$1";

In addition to setting this variable, you must put in place an appropriate script or server rewrite rule to handle these URLs.

Example configurations

These examples include sample .htaccess files for Apache servers using mod_rewrite.

Other servers will have other ways of accomplishing URL rewrites.

Action paths from root

This sets up action paths of the form http://mywiki.example.com/edit/Cucumber etc.

LocalSettings.php
$actions = [
	'view',
	'edit',
	'watch',
	'unwatch',
	'delete',
	'revert',
	'rollback',
	'protect',
	'unprotect',
	'markpatrolled',
	'render',
	'submit',
	'history',
	'purge',
	'info',
];

foreach ( $actions as $action ) {
  $wgActionPaths[$action] = "/$action/$1";
}
$wgArticlePath = $wgActionPaths['view'];

extra htaccess rules

.htaccess
Be sure to modify "/w/index.php" to where you have MediaWiki installed
RewriteRule ^/([a-z]*)/(.*)$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]

action at the end

This sets up action paths of the form http://mywiki.example.com/Cucumber/edit etc.

$actions = [
	'edit',
	'watch',
	'unwatch',
	'delete',
	'revert',
	'rollback',
	'protect',
	'unprotect',
	'markpatrolled',
	'render',
	'submit',
	'history',
	'purge',
	'info',
];

foreach ( $actions as $action ) {
  $wgActionPaths[$action] = "/$1/$action";
}
$wgActionPaths['view'] = "/$1";
$wgArticlePath = $wgActionPaths['view'];

Non root action paths

For standard example.com/wiki/Main_Page rewrites to example.com/wiki/view/Main_Page use above config and change this line to include "/wiki":

foreach ( $actions as $action ) {
  $wgActionPaths[$action] = "/wiki/$action/$1";
}

For standard example.com/wiki/Main_Page view urls, and rewrites to example.com/wiki/edit/Main_Page

$actions = [
	'edit',
	'watch',
	'unwatch',
	'delete',
	'revert',
	'rollback',
	'protect',
	'unprotect',
	'markpatrolled',
	'render',
	'submit',
	'history',
	'purge',
	'info',
];

foreach ( $actions as $action ) {
  $wgActionPaths[$action] = "/wiki/$action/$1";
}
$wgActionPaths['view'] = "/wiki/$1";
$wgArticlePath = $wgActionPaths['view'];

action at the end

For standard example.com/wiki/Main_Page view urls, and rewrites to example.com/wiki/Main_Page/edit

you cannot have subpages of main pages named "delete, edit, watch, unwatch" etc from the array when setup like this.
$actions = [
	'view',
	'edit',
	'watch',
	'unwatch',
	'delete',
	'revert',
	'rollback',
	'protect',
	'unprotect',
	'markpatrolled',
	'render',
	'submit',
	'history',
	'purge',
	'info',
];

foreach ( $actions as $action ) {
  $wgActionPaths[$action] = "/wiki/$1/$action";
}
$wgActionPaths['view'] = "/wiki/$1";
$wgArticlePath = $wgActionPaths['view'];

Virtual action / directories

This sets up URLs such as http://mywiki.example.com/wiki/action/edit/Cucumber etc.

To rewrite most[1] actions to a specific path, one could make the following changes to LocalSettings.php :

$actions = [
	'view',
	'edit',
	'watch',
	'unwatch',
	'delete',
	'revert',
	'rollback',
	'protect',
	'unprotect',
	'markpatrolled',
	'render',
	'submit',
	'history',
	'purge',
	'info',
];

foreach ( $actions as $action ) {
  $wgActionPaths[$action] = "$wgScriptPath/action/$action/$1";
}
$wgArticlePath = $wgActionPaths['view'];

In Apache, code a rewrite rule similar to the following:

RewriteRule ^/action/([a-z]*)/(.*)$ /index.php [L,QSA]

This will forward all requests to /action/actionword/title to MediaWiki's index.php which will parse the action and title according to your $wgActionPaths settings.

When configuring Apache mod_negotation to execute PHP scripts when using this method care should be taken not to cause 406 Not Acceptable errors that might in some cases expose a directory listing, see [1], [2]. See also bugzilla:21617.

Spam prevention

Using $wgActionPaths, especially for the edit action seems to reduce the number of spam bots attempting article edits. It is suspected that bots are programmed to look for action=edit to identify a MediaWiki installation and act appropriately. With this in mind, it would be beneficial to name your action prefix something non-apparent so bots can't find your site when they start looking for action/edit.


  1. It is currently not possible to have a $wgActionPath for the 'raw' action.