如何从MediaWiki的URL中删除index.php? [英] How to remove index.php from the URL of MediaWiki?

查看:198
本文介绍了如何从MediaWiki的URL中删除index.php?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此工具 http://shorturls.redwerks.org/重写了MediaWiki的短网址. 从这个:http://wikitest.org/fr/index.php/Accueil到这个:http://wikitest.org/fr/wiki/Accueil.

I used this tool http://shorturls.redwerks.org/ to rewrite a short url for MediaWiki. From this: http://wikitest.org/fr/index.php/Accueil to this: 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

但是,当我转到自己的网站时,会得到 404 Not Found (找不到).在此服务器上找不到请求的资源!

But when I go to my site I get 404 Not Found. The resource requested could not be found on this server!

推荐答案

LocalSettings.php的更改仅影响您Wiki中的链接.您还需要向服务器添加适当的重写规则,以便实际上有一些内容可供用户查看.在您的情况下,假设您正在运行Apache,则可以在.htaccess中添加类似的内容:

The changes to LocalSettings.php affects only the links in your wiki. You also need to add the proper rewrite rules to your server,so that there is actually something there for the user to see. In your case, adding something like this to .htaccess might work, assuming you are running Apache:

RewriteEngine On
RewriteRule ^/?fr/wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
RewriteRule ^/fr*$ %{DOCUMENT_ROOT}/w/index.php [L]

您可以在手册中找到有关服务器的详细说明.

You can find detailed instructions for your server in the manual.

这篇关于如何从MediaWiki的URL中删除index.php?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆