Last modified: 2010-05-15 15:33:19 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T3562, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 1562 - Rewrite rules not functioning...
Rewrite rules not functioning...
Status: RESOLVED INVALID
Product: MediaWiki
Classification: Unclassified
Installer (Other open bugs)
1.4.x
PC Windows XP
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://meta.wikimedia.org/wiki/Rewrit...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-02-19 15:28 UTC by Brian Collins
Modified: 2010-05-15 15:33 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Brian Collins 2005-02-19 15:28:37 UTC
I tried them all, but they don't seem to be working... The rewrite_rules page and 
discussion don't seem to have updated info for version 1.4...

If *anyone* has version 1.4 running could you please post what you have in 
your .htaccess and your localsettings.php to make the rewrite work? Basically i setup 
wiki.mydomain.com to point to mydomain.com/wiki.... What i would like is for the 
whole thing to be wiki.mydomain.com/article_name 

If you have something similar please post it... 

Thanks a bunch
Comment 1 JeLuF 2005-02-19 15:34:44 UTC
Please be more specific than "does not work".
Comment 2 Brian Collins 2005-02-19 15:38:17 UTC
(In reply to comment #1)
> Please be more specific than "does not work".

Thanks for replying...

getting "500 internal server error"...

perhaps you can tell me what you have in your files so i can try setting it up the same way?
Comment 3 T. Gries 2005-02-19 15:54:11 UTC
(In reply to comment #0)
> I tried them all, but they don't seem to be working... The rewrite_rules page and 
> discussion don't seem to have updated info for version 1.4...
I support you. Installing a mediawiki can take less than 2 minutes, but trying
rewriting can be a horror story.

Perhaps, please, can someone of the developers check and update the info on
http://meta.wikimedia.org/wiki/Rewrite_rules ?
Comment 4 Brion Vibber 2005-02-19 21:00:52 UTC
URL rewriting is external to MediaWiki and there should be no difference at 
all between 1.3 and 1.4 in this regard.

If you're getting 500 Internal Server Error problems, a common problem is 
using an .htaccess file with directives that your Apache configuration does 
not allow you to override in an .htaccess file. If you're running your own 
server, check the settings in the global configuration; if you're on a shared 
host ask your system administrator. Show them the .htaccess file you're 
trying to use, ask if that's allowed and if there's a change either you or they 
can make to get it working.
Comment 5 Brian Collins 2005-02-20 08:11:50 UTC
(In reply to comment #4)
> URL rewriting is external to MediaWiki and there should be no difference at 
> all between 1.3 and 1.4 in this regard.
> If you're getting 500 Internal Server Error problems, a common problem is 
> using an .htaccess file with directives that your Apache configuration does 
> not allow you to override in an .htaccess file. If you're running your own 
> server, check the settings in the global configuration; if you're on a shared 
> host ask your system administrator. Show them the .htaccess file you're 
> trying to use, ask if that's allowed and if there's a change either you or they 
> can make to get it working.


I have other scripts on the site (serendipity blog) that has an option in the web interface to use rewriting (i checked the htaccess file it 
produced and it's like this:

# BEGIN s9y
ErrorDocument 404 /serendipity/index.php
DirectoryIndex /serendipity/index.php

RewriteEngine On
RewriteBase /serendipity/
RewriteRule ^archives/(\d+)\.html index.php?url=/archives/$1.html [L,QSA]
RewriteRule ^archives/(\d+)[_\-]short\.html index.php?url=/archives/$1-short.html [L,NC,QSA]
RewriteRule ^([0-9]+)[_\-][0-9a-z_\-]*\.html index.php?url=$1-article.html [L,NC,QSA]
RewriteRule ^feeds/(.*) index.php?url=/feeds/$1 [L,QSA]
RewriteRule ^unsubscribe/(.*)/([0-9]+) index.php?url=/unsubscribe/$1/$2 [L,QSA]
RewriteRule ^approve/(.*)/(.*)/([0-9]+) index.php?url=approve/$1/$2/$3 [L,QSA]
RewriteRule ^delete/(.*)/(.*)/([0-9]+) index.php?url=delete/$1/$2/$3 [L,QSA]
RewriteRule ^admin$ serendipity_admin.php [L,QSA]
RewriteRule ^entries$ serendipity_entries.php [L,QSA]
RewriteRule ^archive$ index.php?url=/archive [L,QSA]
RewriteRule ^categories/(\d+)[_\-].* index.php?url=archive/$1 [L,QSA]
RewriteRule ^(index|atom|rss|b2rss|b2rdf).(rss|rdf|rss2|xml)$ rss.php?file=$1&ext=$2
RewriteRule ^plugin/(.*) index.php?url=plugin/$1 [L,QSA]
RewriteRule ^index\.(html?|php.?) index.php?url=index.html [L,QSA]
RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
RewriteRule (.*\.html?) index.php?url=/$1 [L,QSA]

<Files *.tpl>
    deny from all
</Files>

<Files *.sql>
    deny from all
</Files>

<Files *.inc.php>
    deny from all
</Files>

<Files *.db>
    deny from all
</Files>

# END s9y

It works perfectly ok. Looks like this now http://www.mydomain.com/serendipity/archives/1-article.html.

I tried several of the uggestions from the rewrite_rules page and the talk:rewrite_rules, but this is what happened:

First tried modifying htaccess (+ added |skins to rewrite rules as per instructions) without touching localsettings.php... mydomain.com/wiki 
automatically redirected to mydomain.com/wiki/index.php?title=Main_page ... then modified localsettings.php as per suggestions... same 
thing. Tried other users' implementations... same thing or didn't work. Then removed htaccess and reverted localsettings.php back, then the 
main page appears without any skin. I don't know what i did to revert it back to normal again. So then i stopped trying.

If you know what should be included in the htaccess and localsettings for 1.4beta6 to work Brion, please tell. I would appreciate it a lot, 
as i'm sure others will too...

Thanks.
Comment 6 Anders Wegge Jakobsen 2005-02-20 08:29:16 UTC
(In reply to comment #0)
> I tried them all, but they don't seem to be working... The rewrite_rules page and 
> discussion don't seem to have updated info for version 1.4...
> 
> If *anyone* has version 1.4 running could you please post what you have in 
> your .htaccess and your localsettings.php to make the rewrite work? Basically
i setup 
> wiki.mydomain.com to point to mydomain.com/wiki.... What i would like is for the 
> whole thing to be wiki.mydomain.com/article_name 
> 
> If you have something similar please post it... 

The URL rewrites described on http://wiki.wegge.dk/MediaWiki_customizations
works for me. Are you absolutely sure that you remebered the RewriteEngine on
directive?
Comment 7 Brian Collins 2005-02-20 13:59:07 UTC
(In reply to comment #6)
> (In reply to comment #0)
> > I tried them all, but they don't seem to be working... The rewrite_rules page and 
> > discussion don't seem to have updated info for version 1.4...
> > 
> > If *anyone* has version 1.4 running could you please post what you have in 
> > your .htaccess and your localsettings.php to make the rewrite work? Basically
> i setup 
> > wiki.mydomain.com to point to mydomain.com/wiki.... What i would like is for the 
> > whole thing to be wiki.mydomain.com/article_name 
> > 
> > If you have something similar please post it... 
> The URL rewrites described on http://wiki.wegge.dk/MediaWiki_customizations
> works for me. Are you absolutely sure that you remebered the RewriteEngine on
> directive?

I followed the instructions on the site you listed to the letter, and basically this is what happens: http://mydomain.com/wiki and 
http://mydomain.com/wiki/index.php return a 404 not found error, http://mydomain.com/wiki/index.php?title=Main_page returns the normal main 
page, but then clicking a link from there returns a non-skinned page. The rewrites don't seem to work as it still shows up as index.php?
title= ...

This is what i put in the .htaccess: (notice i changed /w/ to /wiki/)

##############################################################
# Rewrite rules for a MW installation with normal article view
# without index.php and /w/ in front of all other links.
  
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|skins)/
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
RewriteCond %{REQUEST_URI} !^/wiki/

# Rewrite anything not matched by the rules above.
RewriteRule ^/(.*)$ /index.php/$1 [L,QSA]

# Remove the /w/ from the edit links
RewriteRule ^/wiki/(.*)$ /$1 [L,QSA]
##############################################################

Here is my LocalSettings.php:

##############################################################
<?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/content/m/i/b/mibolox/html/wiki";
ini_set( "include_path", ".:$IP:$IP/includes:$IP/languages" );
require_once( "includes/DefaultSettings.php" );

# If PHP's memory limit is very low, some operations may fail.
# ini_set( 'memory_limit', '20M' );

if ( $wgCommandLineMode ) {
	if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
		die( "This script must be run from the command line\n" );
	}
} elseif ( empty( $wgConfiguring ) ) {
	## Compress output if the browser supports it
	if( !ini_get( 'zlib.output_compression' ) ) @ob_start( 'ob_gzhandler' );
}

$wgSitename         = "MyDomain";

$wgScriptPath	    = "";
$wgScript           = "$wgScriptPath/wiki/index.php";
$wgRedirectScript   = "$wgScriptPath/redirect.php";

## If using PHP as a CGI module, use the ugly URLs
# $wgArticlePath      = "$wgScriptPath/$1";
$wgArticlePath      = "$wgScriptPath/$1";

$wgStylePath        = "$wgScriptPath/skins";
$wgStyleDirectory   = "$IP/skins";
$wgLogo             = "$wgStylePath/common/images/wiki.png";

$wgUploadPath       = "$wgScriptPath/images";
$wgUploadDirectory  = "$IP/images";

$wgEmergencyContact = "support@mydomain.com";
$wgPasswordSender	= "support@mydomain.com";

$wgDBserver         = "mysql12.secureserver.net";
$wgDBname           = "mywiki";
$wgDBuser           = "mywiki";
$wgDBpassword       = "wiki1111";
$wgDBprefix         = "";

## 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";

# If you're on MySQL 3.x, this next line must be FALSE:
$wgDBmysql4 = $wgEnablePersistentLC = true;

## Shared memory settings
$wgUseMemCached = false;
$wgMemCachedServers = array();
#$wgUseTurckShm = function_exists( 'mmcache_get' ) && php_sapi_name() == 'apache';

## 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;

# Specify who can edit: true means only logged in users may edit pages
$wgWhitelistEdit = true;

#$wgGoToEdit = true;

$wgLanguageCode = "en";
$wgUseLatin1 = false;

# Specify if Users can use mystyle.css in their User:Name/mystyle.css page
#$wgAllowUserCss = true;

#The wiki cache does not automatically have articles purged that reference a
#newly created or deleted category, perhaps for performance reasons.
#A better work-around is to use the action=purge option to flush the wiki cache,
#e.g. .../index.php?title=The_article&action=purge
#Caching at the wiki can be disabled by adding the following line to LocalSettings.php
#$wgEnableParserCache = false;


$wgProxyKey = "424a4be25072385e2589ff7e573b1567787b084174f02325387c1ed24227a353";

## Default skin: you can change the default skin. Use the internal symbolic
## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook':
# $wgDefaultSkin = 'monobook';

## 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.
# $wgEnableCreativeCommonsRdf = true;
$wgRightsPage = ""; # Set to the title of a wiki page that describes your license/copyright
$wgRightsUrl = "";
$wgRightsText = "";
$wgRightsIcon = "";
# $wgRightsCode = ""; # Not yet used

?>
##############################################################

If the code looks ok to you then i'll just give up... i don't think it's a server problem as rewrite works with another script i have 
(serendipity)...

Just a quick question though... i put the .htaccess in the /wiki directory where the wiki is... did you put it in the root folder? If not, 
do you have anything special in the htaccess of the root folder? Maybe it didn't work for me because you set your script to remove ethe /w/ 
part for you... but i need to keep the /wiki/ part of the URL... do you know how to modify the htaccess and the LocalSettings.php in that 
case?

Thanks

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links