Index.html不是我的默认页面(不知怎的,我的wiki覆盖了它)

时间:2016-04-26 18:24:09

标签: html .htaccess mediawiki

我在我的网站上安装了mediawiki。我有一个问题,我的维基页面是从www.mywebsite / mywiki / index.php / mywikipage开始的。我想摆脱这个" index.php"所以我通过这个网站为我的维基做了简短的网址:http://shorturls.redwerks.org/。从这里我得到一个代码.htaccess:

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

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2 [L,QSA,B]

RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^/?w/images/thumb/archive/[0-9a-f]/[0-9a-f][0-9a-f]/([^/]+)/([0-9]+)px-.*$ %{DOCUMENT_ROOT}/w/thumb.php?f=$1&width=$2&archived=1 [L,QSA,B]

另一个是我的wiki文件夹中的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 = "/w";
$wgScriptExtension = ".php";
$wgArticlePath = "/wiki/$1";
$wgUsePathInfo = true;

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads  = true;
$wgGenerateThumbnailOnParse = false;

在此之后,我对wiki页面的URL没有任何问题。但我的网站首页现在转到维基。我希望它回到index.html。我试图将此代码放入我的.htaccess文件中,但仍然无法正常工作。

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
DirectoryIndex index.html

任何帮助都会很棒!谢谢!

1 个答案:

答案 0 :(得分:0)

该规则目前正在将主页重写为/w/index.php

改变这个:

RewriteRule ^/?$ %{DOCUMENT_ROOT}/w/index.php [L]

RewriteRule ^/?$ %{DOCUMENT_ROOT}/index.html [L]

以便hompage请求可以在内部重定向到/index.html