Mailing List Archive

rewrite and htaccess
hi,

i have nearly got it to work, except search is not working. i have
tried different combinations of rewritrules, but to no avail. what i
use is given below, based on the entry in meta.wikipedia. obviously
i don't know mod_rewrite well enough to go much beyond.

i am using mediawiki 1.3.1 installed in /wiki/. the .htaccess file
is in /wiki/.

The LocalSettings.php variables are:
$wgScriptPath = "/wiki";
$wgScript = "$wgScriptPath/index.php";
$wgRedirectScript = "$wgScriptPath/redirect.php";
$wgArticlePath = "$wgScriptPath/$1";

Thanks in advance for your help.
saurav
-----
# .htaccess file.
# first, enable the processing
RewriteEngine on
RewriteBase /wiki

# Verifying if user forgot to put trailling slash. If so, we'll rewrite to Main_Page
RewriteCond %{REQUEST_URI} ^/wiki$
RewriteRule ^(.*) /wiki/index.php [L]


# Don't rewrite requests for files in MediaWiki subdirectories,
# MediaWiki PHP files, HTTP error documents, favicon.ico, or robots.txt
RewriteCond %{REQUEST_URI} !^/wiki/(stylesheets|images)/
RewriteCond %{REQUEST_URI} !^/wiki/(redirect|texvc|index).php
RewriteCond %{REQUEST_URI} !^/error/(40(1|3|4)|500).html
RewriteCond %{REQUEST_URI} !^/wiki/favicon.ico
RewriteCond %{REQUEST_URI} !^/robots.txt

# Make sure there is no query string. /Adrian
# This gives "badly formed search query".
# gets /wiki/Special:Search?search=somequery&go=Go instead of
# /wiki/index.php?search=somequery&go=Go
RewriteCond %{QUERY_STRING} ^$ [OR] RewriteCond %{REQUEST_URI} ^/wiki/Special:Search


# Rewrite any article as wiki/index.php/article and stop
RewriteRule ^(.*)$ index.php?title=$1 [L]
------------
Re: rewrite and htaccess [ In reply to ]
Saurav Pathak wrote:
> i have nearly got it to work, except search is not working.
[snip]
> # Rewrite any article as wiki/index.php/article and stop
> RewriteRule ^(.*)$ index.php?title=$1 [L]

Use the QSA (query string append) option.

-- brion vibber (brion @ pobox.com)
Re: rewrite and htaccess [ In reply to ]
Brion Vibber [Thu, Sep 02, 2004 at 03:16:22PM -0700]:

+ Saurav Pathak wrote:
+ >i have nearly got it to work, except search is not working.
+ [snip]
+ ># Rewrite any article as wiki/index.php/article and stop
+ >RewriteRule ^(.*)$ index.php?title=$1 [L]
+
+ Use the QSA (query string append) option.

RewriteRule ^(.*)$ index.php?title=$1 [L,QSA]

everything works now. thanks.

--
saurav