MediaWiki短鏈接配置

官方文檔:http://www.mediawiki.org/wiki/Manual:Short_URL#URL_like_-_wiki.example.com.2FPage_titlephp

配置方式有:apache

URL like - example.com/wiki/Page_title(我選擇的是這種,和wikipedia相同),這個的官方連接:http://www.mediawiki.org/wiki/Manual:Short_URL/wiki/Page_title
URL like - example.com/Page_title(官方不推薦,會留下垃圾)
URL like - example.com/sub_directory/wiki/Page_Title
URL like - wiki.example.com/Page_title(官方不推薦,會留下垃圾)

官方文檔上配置相對比較舊,因此留這篇文檔: 吐舌鬼臉app

apache版本爲:2.4.1ide

php版本爲:5.4.0ui

mediawiki版本爲:1.18.xthis

1. First, make sure that MediaWiki is not in a directory under the Apache DocumentRoot (the DocumentRoot is usually something like "htdocs"). This step ensures that you don't overlap articles and files.code

2. In LocalSettings.php, set the following:ip

$wgScriptPath = "/w"; # in default installations this line is already present. /w stands for the actual existing folder with the mediawiki-installation.
$wgScript = "$wgScriptPath/index.php";
$wgArticlePath = "/wiki/$1";  # /wiki stands for the desired URL that you wish to use for accessing the mediawiki-content.

3.a Set up the following in your Apache httpd.conf:文檔

  

  
   
     <Directory C:/xampp/w> # Replace the example C:/xampp/w/ Order allow,deny # by the actual folder-path. Allow from all # This is necessary, when the folder is outside </Directory> # the htdocs-directory, as recommended above. 
   
修改成:    <Directory C:/xampp/w>
    Require all granted
</Directory>
 
    
   
     Alias /w/index.php C:/xampp/w/index.php # Replace the example C:/xampp/w/ 
   
修改成:

Alias /w C:/xampp/w # Replace the example C:/xampp/w/
Alias /wiki C:/xampp/w/index.php # by the actual folder-path. Alias /index.php C:/xampp/w/index.php #

3.b Or in more recent versions of Apache look for: get

 
  
  ScriptAlias /cgi-bin/ 

 

and add below

 
  
  ScriptAlias /w/index.php C:/xampp/w/index.php # Replace the example C:/xampp/w/ ScriptAlias /wiki C:/xampp/w/index.php # by the actual folder-path. ScriptAlias /index.php C:/xampp/w/index.php # 

 

4. Restart Apache.

5. Create a directory "w" under your DocumentRoot and move /path/to/your/MediaWiki/installation/skins to this directory.

Instead of moving your skins directory, you can append this line to your alias for the same effect:

Alias /w/skins/ C:/xampp/w/skins/        # Replace C:/xampp/w/ as above.

If this still causes 404 errors place it as the first alias.

To Fix the links to any images you have, append this line also:

Alias /w/images/ C:/xampp/w/images/      # Replace C:/xampp/w/ as above.
相關文章
相關標籤/搜索