미디어위키 간편URL 적용

Jmnote bot (토론 | 기여)님의 2015년 2월 12일 (목) 02:45 판 (로봇: 자동으로 텍스트 교체 (-[root@jmnote +[root@zetawiki))

1 개요

미디어위키 단축 URL 사용, 미디어위키 단축 주소
미디어위키 짧은 URL 적용, 미디어위키 짧은 주소 적용

2 미디어위키 폴더 이름 변경

미디어위키 폴더 이름이 w가 아니었다면 w로 변경 (여기서는 mediawiki 이었던 예시)

[root@zetawiki html]# ll
... (생략)
drwxr-xr-x 16 root root   4096 Aug 16 17:58 mediawiki
[root@zetawiki html]# mv mediawiki w
[root@zetawiki html]# ll
... (생략)
drwxr-xr-x 16 root root   4096 Aug 16 17:58 w

3 LocalSettings.php 수정

수정 전
$wgScriptPath       = "/mediawiki";
$wgScriptExtension  = ".php";
수정 후
$wgScriptPath       = "/w";
$wgScript           = "$wgScriptPath/index.php";
$wgArticlePath      = "/wiki/$1";
$wgScriptExtension  = ".php";

4 httpd.conf 수정

  • httpd.conf 파일의 DocumentRoot 행 아래에 내용 추가. (DocumentRoot 줄 자체는 수정하면 안됨.)
  • 아래 예시는 DocumentRoot가 /var/www/html일 때의 예시이다. 만약 다르다면 /var/www/html 부분을 모두 찾아 DocumentRoot 값에 맞게 바꿔줘야 한다.
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"
#RedirectMatch /mediawiki/index.php/(.*)$ http://jmnote.com/wiki/$1
#RedirectMatch /mediawiki/index.php?(.*)$ http://jmnote.com/w/index.php?$1
#RedirectMatch /mediawiki/images/(.*)$ http://jmnote.com/w/images/$1
Alias /wiki /var/www/html/w/index.php
Alias /index.php /var/www/html/w/index.php
Alias /w/skins/ /var/www/html/w/skins/
Alias /w/images/ /var/www/html/w/images/
→ RedirectMatch는 기존 주소[1]를 새 주소[2]로 포워딩해주는 역할을 한다. (새 사이트 구축시는 필요 없다.)
→ 검색엔진에 등록된 기존 주소가 끊어지지 않도록 하려면 RedirectMatch 3줄 주석 해제.[3]

5 아파치 재시작

[root@zetawiki html]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

6 같이 보기

7 주석

  1. http://도메인/mediawiki/index.php/표제어
  2. http://도메인/wiki/표제어
  3. 물론 jmnote.com은 자신의 도메인으로 바꿔주시라.

8 참고 자료