我使用此工具http://shorturls.redwerks.org/重写了MediaWiki的短网址。从这个:http://wikitest.org/fr/index.php/Accueil到这个:http://wikitest.org/fr/wiki/Accueil。
Then I added this code to LocalSettings.php:
## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "/fr";
$wgScriptExtension = ".php";
$wgArticlePath = "{$wgScriptPath}/wiki/$1";
$wgUsePathInfo = true
Run Code Online (Sandbox Code Playgroud)
但是,当我转到自己的网站时,会看到404 Not Found。在此服务器上找不到请求的资源!
对LocalSettings.php所做的更改仅影响您Wiki中的链接。您还需要向服务器添加正确的重写规则,以便实际上有一些内容可供用户查看。在您的情况下,.htaccess假设您正在运行Apache ,则可以添加如下所示的内容:
RewriteEngine On
RewriteRule ^/?fr/wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteRule ^/fr*$ %{DOCUMENT_ROOT}/w/index.php [L]
Run Code Online (Sandbox Code Playgroud)
您可以在手册中找到有关服务器的详细说明。
| 归档时间: |
|
| 查看次数: |
2201 次 |
| 最近记录: |