【问题标题】:Index.html is not my default page (somehow my wiki overwrote it)Index.html 不是我的默认页面(不知何故我的 wiki 覆盖了它)
【发布时间】:2016-04-26 18:24:08
【问题描述】:

我在我的网站上安装了 mediawiki。我的 wiki 页面以 www.mywebsite/mywiki/index.php/mywikipage 开头时遇到了问题。我想摆脱这个“index.php”,所以我用这个网站创建了我的 wiki 的短网址: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 不再有问题。但是我的网站首页现在转到 wiki。我希望它回到 index.html。我尝试将此代码放入我的 .htaccess 文件中,但仍然无法正常工作。

Options +FollowSymlinks
RewriteEngine on
RewriteBase /
DirectoryIndex index.html

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

【问题讨论】:

    标签: html .htaccess mediawiki


    【解决方案1】:

    规则当前正在重写主页到/w/index.php

    改变这个:

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

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

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

    【讨论】:

    • 它没有帮助。此外,当我想点击我的 wiki 上的一个页面时,它给了我这个:i.imgur.com/ZC2hgaQ.png 这是我的实际网站(没有样式和其他视觉内容)。
    猜你喜欢
    • 2020-01-16
    • 2020-08-26
    • 1970-01-01
    • 1970-01-01
    • 2022-01-11
    • 1970-01-01
    • 2010-12-05
    • 1970-01-01
    • 2013-02-03
    相关资源
    最近更新 更多