所以我将我的Mediawiki网站移动到新服务器。版本1.20.3在运行Ubuntu 12.04的旧服务器上运行良好。但是,当我将所有内容复制到运行Ubuntu 14.04的新服务器时,它没有。因此,在搞砸了一段时间后,我认为可以更容易地同时从1.20.3升级到1.24.2。
我得到了1.24.2。来自Mediawiki下载网站。拉开拉链。运行maintenance / upgrade.php并将我的所有扩展,图像,上传,皮肤,徽标和LocalSettings.php文件从1.20.3复制到1.24.2。只要我使用http://wikis.controltheorypro.com/index.php?title=Main_Page,1.24.2网站就可以正常使用,但在我使用http://wikis.controltheorypro.com/Main_Page或http://wikis.controltheorypro.com/(重定向到http://wikis.controltheorypro.com/Main_Page)时则不行。
重定向在旧服务器上正常工作1.20.3。 LocalSetting.php或DB中的某些内容仍然告诉Mediawiki使用漂亮的URL,因为我的主页上的所有URL都缺少index.php?title = URL的一部分。
我是一个相当称职的PHP和服务器人,但这是一个旧网站,我只是在移动服务器时真正处理它。这是几年前我付出了很多努力的网站。我现在已经杀了它,但它似乎从学生那里获得了大量的流量,所以我保持活着。
我已尝试通过Google和Mediawiki网站提供多种解决方案。
我的.htaccess在这一点上很乱,但现在是:
#RewriteEngine on
#RewriteCond %{HTTP_HOST} ^controltheorypro.com$ [OR]
#RewriteCond %{HTTP_HOST} ^www.controltheorypro.com$
#RewriteRule ^/?$ "http\:\/\/wikis\.controltheorypro\.com" [R=301,L]
<IfModule mod_rewrite.c>
# Turn on mod_rewrite
RewriteEngine On
# Virtual path to index.php
RewriteRule ^/?(/.*)?$ %{DOCUMENT_ROOT}/index.php [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-d
RewriteRule ^(.*)$ %{DOCUMENT_ROOT}/index.php [L]
RewriteRule ^/*$ %{DOCUMENT_ROOT}/index.php [L]
# If you are converting from a static site to a wiki,
# you'll want to make redirections to the new article.
#RewriteRule ^old-file.html$ http://www.example.com/New_Article [R=permanent,L]
# This hack lets you essentially gets rid of the redirection
# to "Main Page". Conversely, if you go to http://www.example.com/Main_Page,
# it sends an permanent external redirection to http://www.example.com/.
RewriteRule ^Main_Page$ http://wikis.controltheorypro.com/ [R=permanent,L]
RewriteRule ^$ /var/www/html/CTP/mediawiki-1.24.2/index.php?title=Main_Page&redirect=no [QSA,L]
RewriteRule ^/new/rss http://wikis.controltheorypro.com/index.php?title=Special:NewPages&feed=rss [QSA,L]
RewriteRule ^/do/([a-z]*)/(.*)$ /var/www/html/CTP/mediawiki-1.24.2/index.php?action=$1&title=$2 [QSA,L]
# Finally, if we've gotten this far, process it as if it's an article,
# UNLESS it's a physical file/directory/symlink.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ /var/www/html/CTP/mediawiki-1.24.2/index.php?title=$1 [QSA,L]
</IfModule>
的LocalSettings.php:
<?php
# This file was automatically generated by the MediaWiki 1.20.3
# installer. If you make manual changes, please keep track in case you
# need to recreate them later.
#
# See includes/DefaultSettings.php for all configurable settings
# and their default values, but don't forget to make changes in _this_
# file, not there.
#
# Further documentation for configuration settings may be found at:
# http://www.mediawiki.org/wiki/Manual:Configuration_settings
# Protect against web entry
if ( !defined( 'MEDIAWIKI' ) ) {
exit;
}
## Uncomment this to disable output compression
# $wgDisableOutputCompression = true;
$wgSitename = "ControlTheoryPro.com";
## 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
## (like /w/index.php/Page_title to /wiki/Page_title) please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL
$wgScriptPath = "";
$wgScriptExtension = ".php";
## Added by me to enable pretty permalinks
$wgArticlePath = "$wgScriptPath/$1";
$wgUsePathInfo = true;
## The protocol and server name to use in fully-qualified URLs
$wgServer = "http://wikis.controltheorypro.com";
## The relative URL path to the skins directory
$wgStylePath = $wgScriptPath . "/skins";
## The relative URL path to the logo. Make sure you change this from the default,
## or else you'll overwrite your logo when you upgrade!
$wgLogo = $wgServer . "/logo.gif"; // "/wiki_symbol_default_size.png"; // "$wgStylePath/common/images/wiki.png";
## UPO means: this is also a user preference option
$wgEnableEmail = true;
$wgEnableUserEmail = true; # UPO
$wgEmergencyContact = "admin@controltheorypro.com";
$wgPasswordSender = "admin@controltheorypro.com";
$wgEnotifUserTalk = false; # UPO
$wgEnotifWatchlist = false; # UPO
$wgEmailAuthentication = true;
## Database settings
....
# MySQL specific settings
$wgDBprefix = "";
# MySQL table options to use during installation or update
$wgDBTableOptions = "ENGINE=InnoDB, DEFAULT CHARSET=binary";
# Experimental charset support for MySQL 5.0.
$wgDBmysql5 = false;
## Shared memory settings
$wgMainCacheType = CACHE_MEMCACHED;
$wgMemCachedServers = array( '127.0.0.1:11211' );
## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads = true;
#$wgUseImageMagick = true;
#$wgImageMagickConvertCommand = "/usr/bin/convert";
# InstantCommons allows wiki to use images from http://commons.wikimedia.org
$wgUseInstantCommons = true;
## If you use ImageMagick (or any other shell command) on a
## Linux server, this will need to be set to the name of an
## available UTF-8 locale
$wgShellLocale = "en_US.utf8";
## If you want to use image uploads under safe mode,
## create the directories images/archive, images/thumb and
## images/temp, and make them all writable. Then uncomment
## this, if it's not already uncommented:
#$wgHashedUploadDirectory = false;
## Set $wgCacheDirectory to a writable directory on the web server
## to make your wiki go slightly faster. The directory should not
## be publically accessible from the web.
#$wgCacheDirectory = "$IP/cache";
# Site language code, should be one of the list in ./languages/Names.php
$wgLanguageCode = "en";
$wgSecretKey = ...;
# Site upgrade key. Must be set to a string (default provided) to turn on the
# web installer while LocalSettings.php is in place
$wgUpgradeKey = ...;
## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook', 'vector':
$wgDefaultSkin = "gumaxdd"; // "vector";
## For attaching licensing metadata to pages, and displaying an
## appropriate copyright notice / icon. GNU Free Documentation
## License and Creative Commons licenses are supported so far.
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "http://creativecommons.org/licenses/by-nc-sa/3.0/";
$wgRightsText = "Creative Commons Attribution Non-Commercial Share Alike";
$wgRightsIcon = "{$wgStylePath}/common/images/cc-by-nc-sa.png";
# Path to the GNU diff3 utility. Used for conflict resolution.
$wgDiff3 = "/usr/bin/diff3"; // Manually added - GTS 04/11/13
# Query string length limit for ResourceLoader. You should only set this if
# your web server has a query string length limit (then set it to that limit),
# or if you have suhosin.get.max_value_length set in php.ini (then set it to
# that value)
$wgResourceLoaderMaxQueryLength = -1;
# The following permissions were set based on your choice in the installer
$wgGroupPermissions['*']['edit'] = false;
# Enabled Extensions. Most extensions are enabled by including the base extension file here
# but check specific extension documentation for more details
# The following extensions were automatically enabled:
require_once( "$IP/extensions/ConfirmEdit/ConfirmEdit.php" );
require_once( "$IP/extensions/Gadgets/Gadgets.php" );
require_once( "$IP/extensions/Math/Math.php" );
require_once( "$IP/extensions/Nuke/Nuke.php" );
require_once( "$IP/extensions/ParserFunctions/ParserFunctions.php" );
require_once( "$IP/extensions/Renameuser/Renameuser.php" );
require_once( "$IP/extensions/Vector/Vector.php" );
require_once( "$IP/extensions/WikiEditor/WikiEditor.php" );
# End of automatically generated settings.
# Add more configuration options below.
# Action Paths - should help with SPAM and pretty up the URLs
# These require a a RewriteRule in the .htaccess though see
# http://www.mediawiki.org/wiki/User:Fo0bar/MediaWiki_root_articles
# for details.
#
# These did not work at first because I had messed with $wgScriptPath
# be careful.
/*
#$wgArticlePath = "/$1";
foreach($wgActions as $action => $value) {
if($value === false) { continue; }
if($action == 'raw') { continue; }
$wgActionPaths[$action] = "$wgScriptPath/do/$action/$1";
}
$wgActionPaths['view'] = $wgArticlePath;
*/
# FavIcon
$wgFavicon = $wgScriptPath . "/favicon.ico";
# Don't allow the site to be iframed
$wgBreakFrames = TRUE;
# Add rel="no follow" to all links
$wgNoFollowLinks = TRUE; // TRUE by default as of 04/11/13 but just in case
# Exceptions to the default rel="no follow" rule
$wgNoFollowDomainExceptions = array(...
# Add Equations to the Site - the URL to mathtex is in Math.body.php (function renderMath)
require_once("$IP/extensions/Math/Math.php");
# Add CAPTCHA
# Config: http://www.mediawiki.org/wiki/Extension:ConfirmEdit
require_once("$IP/extensions/ConfirmEdit/ConfirmEdit.php");
require_once("$IP/extensions/ConfirmEdit/ReCaptcha.php");
$wgCaptchaClass = 'ReCaptcha';
$wgReCaptchaPublicKey = ...;
$wgReCaptchaPrivateKey = ...;
# User permissions wrt CAPTCHA
$wgGroupPermissions['*' ]['skipcaptcha'] = false;
$wgGroupPermissions['user' ]['skipcaptcha'] = false;
$wgGroupPermissions['autoconfirmed']['skipcaptcha'] = false;
$wgGroupPermissions['bot' ]['skipcaptcha'] = true; // registered bots
$wgGroupPermissions['sysop' ]['skipcaptcha'] = true;
# Action permission wrt CAPTCHA
$wgCaptchaTriggers['edit'] = false; // Doesn't show CAPTCHA
$wgCaptchaTriggers['create'] = true;
$wgCaptchaTriggers['addurl'] = true; // Shows CAPTCHA
$wgCaptchaTriggers['createaccount'] = true;
$wgCaptchaTriggers['badlogin'] = true;
# Can also be configured to whitelist by IPs and Confirmed Emails
# Filter out all pages/edits/etc that include the following
# Ref & more examples: http://www.mediawiki.org/wiki/Manual:$wgSpamRegex
$wgSpamRegex = "/". # The "/" is the opening wrapper
"s-e-x|zoofilia|sexyongpin|grusskarte|geburtstagskarten|animalsex|".
"sex-with|dogsex|adultchat|adultlive|camsex|sexcam|livesex|sexchat|".
"chatsex|onlinesex|adultporn|adultvideo|adultweb.|hardcoresex|hardcoreporn|".
"teenporn|xxxporn|lesbiansex|livegirl|livenude|livesex|livevideo|camgirl|".
"spycam|voyeursex|casino-online|online-casino|kontaktlinsen|cheapest-phone|".
"laser-eye|eye-laser|fuelcellmarket|lasikclinic|cragrats|parishilton|".
"paris-hilton|paris-tape|2large|fuel-dispenser|fueling-dispenser|huojia|".
"jinxinghj|telematicsone|telematiksone|a-mortgage|diamondabrasives|".
"reuterbrook|sex-plugin|sex-zone|lazy-stars|eblja|liuhecai|".
"viagra|cialis|levitra|".
"airsoft|estate|facebook|loan|credit|garden|porn|sunless|landscaping|coupons|wartol|xbox|playstation|".
"buy-viagra|-cialis|-levitra|boy-and-girl-kissing|". # These match spammy words
"dirare\.com|". # This matches dirare.com a spammer's domain name
"overflow\s*:\s*auto|". # This matches against overflow:auto (regardless of whitespace on either side of the colon)
"height\s*:\s*[0-4]px|". # This matches against height:0px (most CSS hidden spam) (regardless of whitespace on either side of the colon)
"==<center>\[|". # This matches some recent spam related to starsearchtool.com and friends
"\<\s*a\s*href|". # This blocks all href links entirely, forcing wiki syntax
"display\s*:\s*none". # This matches against display:none (regardless of whitespace on either side of the colon)
"/i"; # The "/" ends the regular expression and the "i" switch which follows makes the test case-insensitive
# The "\s" matches whitespace
# The "*" is a repeater (zero or more times)
# The "\s*" means to look for 0 or more amount of whitespace
# Attempt to eliminate the bots
require_once( "$IP/extensions/AntiBot/AntiBot.php" );
# Citations/References
require_once("$IP/extensions/Cite/Cite.php");
# Category Tree
# Config: http://www.mediawiki.org/wiki/Extension:CategoryTree
$wgUseAjax = true;
require_once( "$IP/extensions/CategoryTree/CategoryTree.php" );
# Wiki SEO
# Details: http://www.mediawiki.org/wiki/Extension:WikiSEO
# Example: {{#seo: title=Your page title | titlemode= append | keywords=these,are,your,keywords | description=Your meta description }}
include_once("$IP/extensions/WikiSEO/WikiSEO.setup.php");
# Add Relation Links to Header
# Details: http://www.mediawiki.org/wiki/Extension:RelationLinks
require_once( "$IP/extensions/RelationLinks/RelationLinks.php" );
# Amazon - Doesn't make me any money but it will allow users to easily buy the
# books
include("extensions/Amazon.php");
# Provide Section Heading Numbers
$wgDefaultUserOptions['numberheadings'] = 1;
# Provide access to outside feeds
require_once( "$IP/extensions/WikiArticleFeeds/WikiArticleFeeds.php" );
require_once( "$IP/extensions/RSS/RSS.php" );
$wgFeed = TRUE; // Use Feed
$wgAdvertisedFeedTypes = array('rss', 'atom'); // Advertise RSS and Atom
$wgFeedCacheTimeout = 3600; // 1 Hour (3600 sec) between feed cache refre$
$wgFeedLimit = 15; // Number of results $
# Dynamic Page List
# Config: http://www.mediawiki.org/wiki/Extension:DynamicPageList_(Wikimedia)
require_once("$IP/extensions/intersection/DynamicPageList.php");
# Show Exceptions for install/dev purposes only - GTS 04/11/13
#$wgShowExceptionDetails = true;
// Prevent New Account Creation (SPAM) - GTS 06/10/13
//$wgGroupPermissions['*']['createaccount'] = false;
// Disables write access (page editing and creation) by default, creates a group named "Write", and grants it
// write access. Users can be manually added to this group via Special:UserRights.
// http://www.mediawiki.org/wiki/Manual:User_rights
$wgGroupPermissions['*']['edit'] = false;
$wgGroupPermissions['*']['createpage'] = false;
$wgGroupPermissions['user']['edit'] = false;
$wgGroupPermissions['user']['createpage'] = false;
$wgGroupPermissions['Write']['edit'] = true;
$wgGroupPermissions['Write' ]['createpage'] = true;
$wgGroupPermissions['sysop']['edit'] = true;
$wgGroupPermissions['sysop' ]['createpage'] = true;
--------解决方案---------
我将以下内容添加到/etc/apache2/sites-available/wikis.controltheorypro.com.conf中,然后重新启动Apache服务器。
# MediaWiki Security
<Directory /var/www/html/CTP/mediawiki-1.24.2/>
# Ignore .htaccess files
AllowOverride All
# Serve HTML as plaintext, don't execute SHTML
#AddType text/plain .html .htm .shtml .php
# Don't run arbitrary PHP code.
#php_admin_flag engine off
# If you've other scripting languages, disable them too.
</Directory>
# MediaWiki Uploads Security
<Directory /var/www/html/CTP/mediawiki-1.24.2/images>
# Ignore .htaccess files
AllowOverride None
# Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php
# Don't run arbitrary PHP code.
php_admin_flag engine off
# If you've other scripting languages, disable them too.
</Directory>
答案 0 :(得分:0)
确保您检查了以下几点: - 启用了mod_rewrite模块 - 你允许htaccess覆盖你想要的设置(检查,如果设置了AllowOverwride指令,例如(这将是最简单的值),请参阅http://httpd.apache.org/docs/current/de/mod/core.html#allowoverride
# your directory definition
AllowOverwride All
# your other definitions
之后重启/重新加载,短网址应该有效。