Beautifying URLs of MediaWiki: Difference between revisions
Jump to navigation
Jump to search
| Line 2: | Line 2: | ||
== 目的: 改成 /wiki/ 式網址 == | == 目的: 改成 /wiki/ 式網址 == | ||
目的: 網址從/ | 目的: 網址從/wiki/index.php/Page_name 改成 /wiki/Page_name 式網址,進而縮短網址 | ||
; 修改方式 | ; 修改方式 | ||
* 修改LocalSettings. | * 修改LocalSettings.php中 $wgArticlePath = "/wiki/$1"; | ||
* 修改apache/conf/httpd.conf | * 修改apache/conf/httpd.conf | ||
<pre> | <pre> | ||
Alias /wiki C:/xampplite/htdocs/ | Alias /wiki C:/xampplite/htdocs/wiki/index.php | ||
Alias /index.php C:/xampplite/htdocs/ | Alias /index.php C:/xampplite/htdocs/wiki/index.php | ||
</pre> | </pre> | ||
重新啟動 apache 服務 | 重新啟動 apache 服務 | ||
Revision as of 00:57, 22 December 2007
目的: 改成 /wiki/ 式網址
目的: 網址從/wiki/index.php/Page_name 改成 /wiki/Page_name 式網址,進而縮短網址
- 修改方式
- 修改LocalSettings.php中 $wgArticlePath = "/wiki/$1";
- 修改apache/conf/httpd.conf
Alias /wiki C:/xampplite/htdocs/wiki/index.php Alias /index.php C:/xampplite/htdocs/wiki/index.php
重新啟動 apache 服務
詳細參考資料
目的: 將網址的 問號 改為 /
目的: 美化MediaWiki的網址。網址由http://en.wikipedia.org/w/index.php?title=Republic_Day 改為 http://en.wikipedia.org/wiki/Republic_Day
修改方式
修改LocalSettings.php
- 安裝MediaWiki至 http://www.yourdomain.com/w 而非 http://www.yourdomain.com/ 或 http://www.yourdomain.com/wiki
- 完成安裝之後,修改 LocalSettings.php
$wgScriptPath = "/w"; $wgArticlePath = "/wiki/$1";
修改 .htaccess
- 增加 .htaccess 至 http://www.yourdomain.com/ 的根目錄
RewriteEngine on # do the rewrite RewriteRule ^wiki/?(.*)$ /w/index.php?title=$1 [L,QSA]
參考:
- MediaWiki - DreamHost - 列出多種美化網址的方法 (last visited: April 5, 2006)
- Pesty’s Articles » 如何讓 MediaWiki 可以使用漂亮的網址 (last visited: April 5, 2006)
適用環境
- 伺服器軟體: Apache/1.3.33 (Unix) + Apache Rewrite Engine
- MediaWiki: 1.5.6