erver URLs and file paths: $wgActionPaths | ||
Paths for various user actions. Used to make URLs prettier. | ||
Introduced in version: | 1.5.0 (r7538) | |
Removed in version: | still in use | |
Allowed values: | Unspecified | |
Default value: | [] | |
Other settings: Alphabetical | By function |
Details
단조로운 페이지 보기 이외의 동작에 대해 'pretty' URL 경로를 설정하기 위해, 이 배열에 추가하십시오. 예를 들어:
$wgActionPaths['edit'] = "$wgScriptPath/edit/$1";
이 변수를 설정하는 것 외에도, 이들 URL을 처리하기 위해 적절한 스크립트 또는 서버 rewrite 규칙을 배치해야 합니다.
Example configurations
이들 예제는 mod_rewrite를 사용하여 아파치 서버에 대해 샘플 .htaccess 파일을 포함합니다. 다른 서버는 URL 재작성(rewrite)을 수행하는 다른 방법을 가질 것입니다.
Action paths from root
이것은 형식 http://mywiki.example.com/edit/Cucumber 등의 동작 경로를 설정합니다.
LocalSettings.php
$actions = array( '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 미디어위키가 설치된 위치로 "/w/index.php"를 수정해야 합니다:
RewriteRule ^/([a-z]*)/(.*)$ %{DOCUMENT_ROOT}/w/index.php [L,QSA]
action at the end
이것은 형식 http://mywiki.example.com/Cucumber/edit 등의 동작 경로를 설정합니다.
$actions = array( '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
표준 example.com/wiki/Main_Page를 example.com/wiki/view/Main_Page로 재작성되는 것에 대해, 위의 구성을 사용하고 "/wiki"를 포함하도록 다음 행을 변경하십시오:
foreach ( $actions as $action ) {
$wgActionPaths[$action] = "/wiki/$action/$1";
}
표준 example.com/wiki/Main_Page 보기 url에 대해, example.com/wiki/edit/Main_Page로 재작성하십시오:
$actions = array( '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
표준 example.com/wiki/Main_Page 보기 url에 대해, example.com/wiki/Main_Page/edit로 재작성하십시오:
$actions = array( '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
이것은 http://mywiki.example.com/wiki/action/edit/Cucumber 등과 같은 URL을 설정합니다.
대부분의 동작을 특정 경로로 재작성하기 위해, LocalSettings.php를 다음과 같이 변경할 수 있습니다:
$actions = array( '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'];
아파치에서, 다음과 유사한 재작성 규칙을 코딩합니다:
RewriteRule ^/action/([a-z]*)/(.*)$ /index.php [L,QSA]
이것은 $wgActionPaths 설정에 따라 동작과 제목을 구문 분석하는 미디어위키의 index.php로 /action/actionword/title에 대한 모든 요청을 전달할 것입니다.
이 메서드를 사용할 때 PHP 스크립트를 실행하도록 아파치 mod_negotation을 구성할 때, 경우에 따라 디렉터리 목록을 노출할 수 있는 406 Not Acceptable errors가 발생하지 않도록 주의해야 하며, [1], [2]를 참조하십시오. 역시 bugzilla:21617를 참조하십시오.
Spam prevention
특히 edit 동작에 대해, $wgActionPaths를 사용하면 기사 편집을 시도하는 스팸 봇의 숫자가 감소하는 것 같습니다. 봇은 미디어위키 설치를 식별하고 적절하게 행동하기 위해 action=edit를 검색하도록 프로그래밍된 것으로 의심됩니다. 이것을 염두에 두고, 봇이 action/edit을 찾기 시작할 때 사이트를 찾을 수 없도록 action 접두사의 이름을 명확하지 않은 이름으로 지정하는 것이 좋습니다.