[Mediawiki-l] Short URL using rewriterule without rename wiki to w

Chee-Yang Chau cychau at gmail.com
Mon May 28 00:57:27 UTC 2012


I found the solution, in .htaccess:

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule .* - [L]

RewriteRule ^wiki/(.+)$ wiki/index.php/$1 [L,QSA]


On Sun, May 27, 2012 at 7:16 AM, Platonides <Platonides at gmail.com> wrote:

> On 24/05/12 03:00, Chee-Yang Chau wrote:
> > Hi,
> >
> > Here is my environment:
> >
> > 1. Fedora Core 16
> > 2. Apache httpd 2.2.22
> > 3. MediaWiki 1.19
> >
> > Most of the short url solution provided are using renaming method: e.g.:
> > wiki to w
> >
> > What if I want to stay with wiki directory without renaming?
>
> Why do you want to do so?
>
> > Can I enjoy short url too ?
> You could, but it's hacky and not recommended.
>
>
> > This is what I have tried:
> (...)
> > When I access my wiki site:  http://localhost/wiki/
> >
> > I get a page without skin.  Is there anything else I miss in rewriterule?
>
> There are two folders to take into account when you use short urls.
> One is the folder containing all mediawiki files, index.php, api.php,
> skins/, includes/...
> The other is the virtual folder where you serve the articles, usually wiki/
>
> Your problem is that when your browser goes to wiki/... to fetch the
> CSS, a image, javascript..., the rewrite rule is returning a wiki page
> (due to the rewrite) instead of the real file.
>
> You should use two different urls there to avoid any collision.
> What's your problem with using two urls? (they don't need to be called
> wiki/ and w/)
>
>
>
> _______________________________________________
> MediaWiki-l mailing list
> MediaWiki-l at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
>



-- 
Best regards,
Chau Chee Yang


More information about the MediaWiki-l mailing list