Manual:Short URL/ko

Short URLs(다른 이름 : URL Rewrites)이란, 문서의 URL에서 라고 하는 문자를 숨기기 위한 기능입니다. 후에 문제를 줄이기 위해서 시작하기 전에 당신의 웹사이트의 안정된 URL 구조를 얻는데 몇 분 걸립니다.

목표
MediaWiki의 일반적인 Installation Path는 대체이하와 같은 경로가 됩니다.
 * (installed as root user)
 * (installed with a shared hosting provider)

MediaWiki의 기본값의 웹페이지 주소는 아래의 예시와 같습니다.
 * (recent versions of MediaWiki, without CGI support)
 * (recent versions of MediaWiki, with CGI support)

아래의 방법을 사용해서 웹페이지 주소를 다음과 같이 짧게 할 수가 있습니다. す
 * 좀 더 일반적인 설정. 서버의 설정 변경을 필요로 하므로 기본값은 없습니다.
 * (not recommended! see below)
 * (not recommended! see below)
 * (not recommended! see below)
 * (not recommended! see below)

Having the page name right in the root of the domain name is not recommended, because it will conflict with files and directories located at the root directory. 예를들면,  디렉터리에 사진 파일을 두면 ( 를  로 하고 있을 경우) "Images"라는 문서명을 가진 문서에 액세스할 수 없습니다.

장점과 단점

 * Advantage: Short URLs hide some technical details from end-users, which can be desirable for site owners. Among other things, this means they can be kept stable when the underlying software changes. (See above for the difference between MediaWiki's default URL structure with CGI enabled vs without). They are also easier to read, remember, and manipulate for visitors. Additionally, short URLs offer an advantage over the default URLs for Search engine optimization, as URLs containing  can be treated less favorably by search engines when calculating page rank.
 * 단점: 설정이 필요하다. 사용하고 있는 호스팅 환경에 따라서는 재작성이 곤란해지는 경우가 있습니다. However, as every widely used webserver is capable of being configured to use short URLs, most paid web hosting services should support this feature. Any host that doesn't offer you this feature is not worth your money.

가이드
웹서버별 단축 URL 설정 공식 가이드. 이 중에서 사용되는 웹서버를 선택합니다. 사용하고 있는 서버 소프트웨어를 모르는 경우, Apache의 가능성이 높습니다.



다른 서버용 가이드

 * 공식 가이드가 위에 다른 Web 서버용으로 쓰여져있는 것드에서도 아는대로, 아래의 가이드는 정보가 오래되었고, 현시점에서는 대부분 되지 않습니다. 최종적으로는 대게 아래의 가이드는 제서될 수 있습니다.

누구라도 설명 문서를 만드로, 그것을 아래의 목록에 기재할 수 있습니다. 새 설명 문서를 만들 때에는 아래의 문서를 참고하면서 적절한 문서명으로 만들도록 유의하세요.각각의 해설에 독자(独自)문서가 있는 경우, 독자(読者)는 싫고 복잡한 작업을 스킵할 수 있습니다. Keep it simple, readable, short, with a separate page per separate solution.

To help others find out which Short URL methods really work, after trying each method please edit the page and increase the "worked" or "didn't_work" numbers for that guide and make a brief (or long, your choice) description on what went wrong by clicking the link on your number.

example.com/wiki/Page_title 같은 주소
Actions such as edit, view history, etc. will still have index.php unless $wgActionPaths are defined.

루트 액세스
These methods require that you have access to the server configuration. If you are on a shared host, you most likely don't. In this case you will be required to use a method that requires "no root access". You can jump directly to the MediaWiki ShortURL Builder tool and follow the on screen instructions after clicking on "I don't have root access".

* Abyss Web Server X2

(for Apache guidance, see the link in the Guides section).

example.com/Page_title - 같은 URL
example.com/Page_title URL의 작성방법:

wiki.example.com/Page_title - 같은 URL
wiki.example.com/Page_title URL の作成方法:

앰퍼샌드(&) 문제
The ampersand problem shows up when you have page titles with symbols in (such as &, ?, #, + and /) that, despite being correctly encoded in the link are not being passed correctly from mod_rewrite to the script. This manifests in 404 page-not-found errors, because the title gets cut off at the special character. For example, clicking on a link to "John & Maria's page" gets a 404, because MediaWiki is looking for a page named "John ".

This is because ampersands in long-form names are treated as query string separators, and would never reach the PHP runtime environment. This is caused by an old and problematic mod_rewrite bug.

해결 방법:

This issue is caused by the  portion of rewrite rules like   which is completely unnecessary and harmful. MediaWiki parses paths directly from the REQUEST_URI so rewrite everything to /index.php.

No Skins
With Ubuntu 8.10 and MediaWiki 1.11.2 (and maybe later versions) if you use the MediaWiki sanctioned directions your skins may fail to load. To fix this, create a symbolic link in /var/www pointing to /var/lib/mediawiki with the value of $wgScriptPath in LocalSettings.php. If, for example, $wgScriptPath is set to "/w" then you need to run the command "sudo ln -s /var/lib/mediawiki /var/www/w".

Alternatively, try setting $wgLoadScript to the original file. If you source url is /wiki with the short url /w, set it to /wiki/load.php.

캐쉬 새로고침
If you notice that your changes to  in LocalSettings.php are not being reflected in mysite.com/wiki/Main_Page, it may be due MediaWiki's caching of the links according to previous settings.

Go to mysite.com/wiki/Main_Page?action=purge to force MediaWiki to regenerate the cached links.

Also you can:
 * 1) execute the MySQL query "TRUNCATE objectcache;", or
 * 2) Ensure  is updated (if  is enabled all you have to do is edit LocalSettings.php to purge it)

Redirect visitor of your domain to your wiki
Our official guides for short url configuration include recommendations on how to point the root of your site to your wiki using your short url config.

For example our Apache guide recommends using this to point your site root to your wiki:

Note that we do not recommend doing a HTTP redirect to your wiki path or main page directly. As redirecting to the main page directly will hard-code variable parts of your wiki's page setup into your server config. And redirecting to the wiki path will result in two redirects. Simply rewrite the root path to MediaWiki and it will take care of the 301 redirect to the main page itself.

If using VirtualHosts, place the rewrite rules into the virtual host declaration!

/wiki에서 /w로 위키 옮기기
A common beginner's mistake is to install MediaWiki itself (the source code, not the short url) in  instead of. Once installed they would realize the mistake when trying to configure Short URLs (which would become difficult as the virtual path then conflicts with the real path).

There is a manual for moving a wiki in general, however that is too complicated if all you need is to change the installation directory (and stay on the same server, same database and same hostname).

Here is what you have to do:


 * 파일 및 만든 다른 config파일들을 백업한다. ( 파일 포함.)
 * Rename the installation directory of MediaWiki on your server from  to.
 * Set  in   to   and remove (or comment out) any definition of   (this variable will be changed again when setting up Short URLs, further on)
 * At this point your wiki should be working normally at
 * Now go through the regular guide to set up short URLs
 * Perform a few tests on your wiki to make sure nothing is broken. Edit a page, visit a few different pages, etc. If anything seems abnormal, revert the changes by restoring your backup of  and other relevant files you might have changed during configuration of short URLs and rename your folder back to.

Note for shared hosting users: Many shared hosting plans offer an application manager to automatically Install, Update and Backup applications such as MediaWiki. If your plan has this and if you want to keep using these features, you should contact their tech support and let them know you just manually changed your MediaWiki installation directory.

관련 항목

 * Explanation of what CGI modules are
 * $wgUsePathInfo - configuration setting that defines whether to use 'pretty' URLs or not
 * Notes on placing your wiki installation in site root directory
 * $wgActionPaths - configuration setting that you can use to define 'pretty' URLs for other actions, like edit or history
 * Clean up URLs RFC - proposes "cleaner URLs for editing, previewing skins, etc."

바깥 고리

 * Apache Module mod_rewrite at Apache.org
 * MediaWiki Short URL Builder Tool - A tool that can automatically generate short url configuration more reliable than the configurations in these manual pages.