rewrite of URL

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

rewrite of URL

Hugh Prior
I am trying to eliminate the "index.php" from my website as described in:
http://meta.wikimedia.org/wiki/Eliminating_index.php_from_the_url
in the subsection "Using a rewrite rule in a .htaccess file".

Basically I would like the same illusion of article names being under a
"wiki" directory that www.wikipedia.org manages.

The "real" software I have put in a "mw" directory, and I want it to look
like it is always the format "wiki/Article_name"

To some degree it works, since I can surf to:
http://www.chainki.com/wiki/Main_Page

but the link to [[My test]] page goes to:
http://www.chainki.com/mw/index.php?title=My_test
(this has 2 errors: 1) it shows the "mw", and 2) it shows the "index.php"
file

while the navigation bar goes to "wiki" but shows the "index.php", e.g.
http://www.chainki.com/wiki/index.php?title=Chainki:Community_Portal

Am I expecting too much of this method?  Can you see what I am doing wrong?
Thanks.

.htaccess is as follows:
------------------------------------------------------
php_flag register_globals off
RewriteEngine on
RewriteRule ^/$ /wiki/Main_Page [R]
RewriteRule ^wiki/?(.*)$ /mw/index.php?title=$1 [L,QSA]
------------------------------------------------------

In LocalSettings.php I have set:
$wgArticlePath  = "/wiki/$1";



_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: rewrite of URL

a@kid

I think you may need to put this in your LocalSettings.php ...
$wgArticlePath = "/wiki/$1";

good luck
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l
Reply | Threaded
Open this post in threaded view
|

Re: rewrite of URL

Michelle-12
In reply to this post by Hugh Prior
Just guessing, but it might be that the first rule, a redirect, is  
interfering with the second one, since you don't have [L] for it. The  
rules I got to work are:

# this makes ugly URL's into pretty ones; if matched, don't do next one
RewriteRule ^wiki/?(.*)$ /mw/index.php?title=$1 [L,QSA]
# this sends plain wiki URL to main page, in case user is looking for  
index
RewriteRule ^wiki/?$ /mw/index.php?title=Main_Page [L]

Also, once I was done messing around with my rules, I had to empty  
the wiki objectcache table to get the internal links to be correct,  
as well as clearing my browser cache.

Michelle

On May 16, 2006, at 7:26 AM, Hugh Prior wrote:


>
> .htaccess is as follows:
> ------------------------------------------------------
> php_flag register_globals off
> RewriteEngine on
> RewriteRule ^/$ /wiki/Main_Page [R]
> RewriteRule ^wiki/?(.*)$ /mw/index.php?title=$1 [L,QSA]
> ------------------------------------------------------
>
> In LocalSettings.php I have set:
> $wgArticlePath  = "/wiki/$1";
>
_______________________________________________
MediaWiki-l mailing list
[hidden email]
http://mail.wikipedia.org/mailman/listinfo/mediawiki-l