Manual talk:$wgActionPaths

"action" Directory
I created an "action" directory with an '.htaccess' and an 'index.php'. RewriteEngine on RewriteRule ^(.*?)/(.*?)$ ../index.php?action=$1&title=$2
 * 1) .htaccess

From the visitor's side, it's identical. I did this because it would not work in conjunction with my other RewriteRules. Egingell 07:20, 16 August 2007 (UTC)

Didn't work for me Kcmartz 16:33, 10 December 2010 (UTC)

Alternate Option
On my setup, it would appear that using a '.htaccess' in the wiki root and using: RewriteRule ^/action/([a-z]*)/(.*)$ /index.php?action=$1&title=$2 [L,QSA] doesn't work as suggested. Using 'RewriteLog', I found that the following works: RewriteRule ^action/([a-z]*)/(.*)$ index.php?action=$1&title=$2 [L,QSA]

Hope this helps somebody. Jean-Lou Dupont 01:17, 9 May 2007 (UTC)

Helped me! I had the same problem. You are a legend. Thank you Jldupont! -- 04:56, 12 May 2007 58.10.167.198

Neither works for me, presumably because of my other rewriting. =/ Sy Ali 00:34, 19 May 2007 (UTC)

Infinite Loop
Using RewriteRule ^/action/([a-z]*)/(.*)$ /index.php?action=$1&title=$2 [L,QSA]

on my .htaccess on (1)(2)(3) and (4) i get an infinite loop :|

RewriteEngine On (1) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d (2) RewriteRule ^wiki/(.*) wiki/index.php?title=$1 [PT,L,QSA] (3) RewriteRule ^wiki/*$ wiki/ [L,QSA] RewriteRule ^/*$ wiki/ [L,QSA] (4)

any ideas? LuisManson
 * I don't know.
 * The rule matches everything including 'index.php' (add  just before it).
 * Same story as number 2.
 * If  is number 4, it's still the same problem as numbers 2 and 3.
 * Egingell 07:20, 16 August 2007 (UTC)

lighttpd and url rewriting
in your vhost conf or something:

in LocalSettings.php or wherever:

BTW, I don't know if you noticed - I hope you did ;) - that in the lighttpd part, I flipped the rewritten substitutions (I think that's what they're called): "^/wiki/a/([a-z]*)/(.*)$" => "/w/index.php?title=$2&action=$1" -- see the $2, then $1 ? I did that, otherwise it wouldn't work. I imagine I would have to compensate for older MW installs, that had the action=FOO&title=BAR instead of title=BAR&action=FOO like it is now. Seems to me lighttpd and MW are taking the query string very literally (which is of course a big fat "duh!").

(I didn't use the syntax highlighting, I don't remember the, um, syntax.)

-- Kjikaqawej 08:47, 6 September 2008 (UTC)

...as for apache
I suppose you could very easily do this for an apache-based mediawiki, since I pretty much ripped the rewrites from that ;).

-- Kjikaqawej 08:49, 6 September 2008 (UTC)

Clean action paths without "action/"
What are the required LocalSettings and .htaccess configurations to have a setup similar to https://wikitech.wikimedia.org/ ?

ie.
 * https://wikitech.wikimedia.org/view/Pagename
 * https://wikitech.wikimedia.org/edit/Pagename

Krinkle 23:13, 12 June 2011 (UTC) ""
 * See also wikitech:Project:URL_layout. Ryan lane 23:43, 14 June 2011 (UTC)
 * Thanks, that looks good. Could you later trace the htaccess/httpd config to enable this as well ? For my localhost I tried the following (mediawiki is installed in htdocs/mediawiki, .htaccess in htdocs/mediawiki/.htaccess) which works, not sure how clean it is though. Krinkle 07:37, 15 June 2011 (UTC)

RewriteEngine On RewriteRule ^view/(.*)$ index.php?action=view&title=$2 [L,QSA] RewriteRule ^edit/(.*)$ index.php?action=edit&title=$2 [L,QSA] RewriteRule ^history/(.*)$ index.php?action=history&title=$2 [L,QSA] RewriteRule ^delete/(.*)$ index.php?action=delete&title=$2 [L,QSA] RewriteRule ^submit/(.*)$ index.php?action=submit&title=$2 [L,QSA] RewriteRule ^purge/(.*)$ index.php?action=purge&title=$2 [L,QSA]


 * If I understand correctly the wikitech approach would also allow for localistion in LocalSettings.php (e.g. 'view' => '/bearbeite/$1', etc.). Is this true? On wikitech it says that e.g. edit.php is a simple wrapper that sets $_REQUEST['action'] and passes control on to index.php. May you please make available the contens of e.g. edit.php here so that for dummies like me can use it. This would be cool. Cheers and thank you. --&#91;&#91;kgh&#93;&#93; 20:04, 18 October 2011 (UTC)

QSA
This worked a little better for me....--Hypergrove (talk) 23:57, 24 November 2012 (UTC) RewriteRule ^/?([a-z]*)/(.*)$ %{DOCUMENT_ROOT}/w/index.php?action=$1&title=$2 [L,QSA]

sample rewriterule of web.config
RewriteRule ^/action/([a-z]*)/(.*)$ /index.php [L,QSA]

would you mind providing a smaple of rewriterule of web.config ?

such as ?



won't work! please help