Hi.
I tried to follow the instructions to serve from file cache directly (link
<https://www.mediawiki.org/w/index.php?title=Manual:File_cache#Serving_cached_pages_directly>)
and to have short url (link
<https://www.mediawiki.org/wiki/Manual:Short_URL/Apache>).
But those two instructions don't seem to be directly compatible. How should
I write the .htaccess file at the web root?
The php7 at the host is slow, so I want to minimize number of redirects /
avoid php.
Current .htaccess at the webroot:
# Enable the rewrite engine
RewriteEngine On
# Short url for wiki pages
# RewriteRule ^/?wiki(/.*)?$ %{DOCUMENT_ROOT}/w/index.php [L]
# Redirect / to Main Page
# RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/index.php [L]
# Serve directly from cache
RewriteBase /
# If a cached page exists under /w/html_cache, do an internal redirect to
it:
RewriteCond %{HTTP_COOKIE} !UserID=
RewriteCond %{QUERY_STRING} !.
ReWriteCond %{THE_REQUEST} ^GET\x20/wiki/([^\x20/]+)\x20HTTP
RewriteCond %{DOCUMENT_ROOT}/w/html_cache/%1.html -s
RewriteRule ^wiki/(.+)$ /w/html_cache/%1.html [B,L,NS]
# Redirect / to cached Main Page
RewriteRule ^/*$ %{DOCUMENT_ROOT}/w/html_cache/Main_Page.html [L]
Permissions for Folders:
0700 web_root/w/cache
0755 web_root/w/html_cache
0755 web_root/w/images
LocalSettings.php
$wgMessageCacheType = CACHE_ACCEL;
$wgUseFileCache = true; // Enable file cache
$wgCacheDirectory = "$IP/cache";
$wgFileCacheDirectory = "$IP/html_cache";
$wgDisableOutputCompression = true; // already used mod_deflat
$wgUseLocalMessageCache = false;
$wgParserCacheType = CACHE_DB;
$wgEnableSidebarCache = true;
# NO DB HITS!
$wgDisableCounters = true;
$wgMiserMode = true;
$wgRevisionCacheExpiry = 3*24*3600;
$wgParserCacheExpireTime = 14*24*3600;
# Serve directly from cache
$wgFileCacheDepth = 0;
Thanks again.