[Mediawiki-l] Rewrite rules and .htaccess
Bruce Bertrand
lists at brucebertrand.com
Fri May 28 03:23:29 UTC 2004
Perhaps this isn't the place to ask this, but....
I'm having trouble getting the rewrite rules to work properly. I can access
my site with:
http://my.url.here/index.php/Article_name
Everything works fine with the URL like this, but I want to eliminate the
"index.php" part of the URL.
When I change my LocalSettings.php and .htaccess (following the user guide's
directions on rewrite rules) the URL rewrite happens. In other words, my
browser tries to get "http://my.url.here/Main_page".
BUT, this results in a "Not found" error (404).
Here's my .htaccess file:
-----------------------------------------------------
# Allow wiki articles to start with a period
<Files .*>
Order Deny,Allow
Allow From All
</Files>
# Allow rewriting URLs
RewriteEngine on
# Don't rewrite requests for files in MediaWiki subdirectories,
# MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt
RewriteCond %{REQUEST_URI} !^/(stylesheets|images)/
RewriteCond %{REQUEST_URI} !^/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/robots.txt
# Rewrite http://wiki.domain.tld/article properly, this is the main rule
RewriteRule ^/(.*) /index.php/$1 [L]
-----------------------------------------------------
And here's my LocalSettings.php file:
<?php
# This file was automatically generated by the MediaWiki installer.
# If you make manual changes, please keep track in case you need to
# recreate them later.
$IP = "/home/my_name/public_html/wikisite";
ini_set( "include_path", "$IP/includes:$IP/languages:" .
ini_get("include_path") );
include_once( "DefaultSettings.php" );
if( $wgCommandLineMode ) {
die( "Can't use command-line utils with in-place install yet, sorry." );
} else {
## Compress output if the browser supports it
if( !ini_get( 'zlib.output_compression' ) ) ob_start( 'ob_gzhandler' );
}
$wgSitename = "wikisite";
$wgScriptPath = "";
$wgScript = "$wgScriptPath";
$wgRedirectScript = "/redirect.php";
## If using PHP as a CGI module, use the ugly URLs
$wgArticlePath = "/$1";
# $wgArticlePath = "$wgScript?title=$1";
$wgStyleSheetPath = "/stylesheets";
$wgStyleSheetDirectory = "$IP/stylesheets";
$wgUploadPath = "/images";
$wgUploadDirectory = "$IP/images";
$wgLogo = "$wgUploadPath/wiki.png";
$wgStockPath = $wgUploadPath;
$wgEmergencyContact = "wwwadmin at wikisite.tld";
$wgPasswordSender = "wwwadmin at wikisite.tld";
$wgDBserver = "localhost";
$wgDBname = "database";
$wgDBuser = "user";
$wgDBpassword = "password";
## To allow SQL queries through the wiki's Special:Askaql page,
## uncomment the next lines. THIS IS VERY INSECURE. If you want
## to allow semipublic read-only SQL access for your sysops,
## you should define a MySQL user with limited privileges.
## See MySQL docs: http://www.mysql.com/doc/en/GRANT.html
#
# $wgAllowSysopQueries = true;
# $wgDBsqluser = "sqluser";
# $wgDBsqlpassword = "sqlpass";
$wgDBmysql4 = $wgEnablePersistentLC = true;
## To enable image uploads, make sure the 'images' directory
## is writable, then uncomment this:
# $wgDisableUploads = false;
$wgUseImageResize = true;
# $wgUseImageMagick = true;
# $wgImageMagickConvertCommand = "/usr/bin/convert";
## If you have the appropriate support software installed
## you can enable inline LaTeX equations:
# $wgUseTeX = true;
$wgMathPath = "{$wgUploadPath}/math";
$wgMathDirectory = "{$wgUploadDirectory}/math";
$wgTmpDirectory = "{$wgUploadDirectory}/tmp";
$wgLocalInterwiki = $wgSitename;
$wgLanguageCode = "en";
$wgInputEncoding = $wgOutputEncoding = "UTF-8";
?>
-------------------------------------------------------------------
Any ideas?
Bruce
More information about the MediaWiki-l
mailing list