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? Can I enjoy short url too ?
This is what I have tried:
File: LocalSettings.php:
$wgArticlePath = "/wiki/$1"; $wgUsePathInfo = true;
File: .htaccess
RewriteEngine On RewriteRule ^wiki/index.php - [L] RewriteRule ^wiki/(.*)$ wiki/index.php/$1 [L,QSA]
When I access my wiki site: http://localhost/wiki/
I get a page without skin. Is there anything else I miss in rewriterule?
On 24/05/12 03:00, Chee-Yang Chau wrote:
Hi,
Here is my environment:
- Fedora Core 16
- Apache httpd 2.2.22
- 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/)
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@gmail.com wrote:
On 24/05/12 03:00, Chee-Yang Chau wrote:
Hi,
Here is my environment:
- Fedora Core 16
- Apache httpd 2.2.22
- 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@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
On Mon, May 28, 2012 at 2:57 AM, Chee-Yang Chau cychau@gmail.com wrote:
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]
This means you can't have articles with any of these names:
* [[bin]] * [[docs]] * [[extensions]] * [[images]] * [[languages]] * [[FAQ]] * [[Maintenance]] * [[Tests]]
..and maybe more.
As documented [1], you should never use the same name for a virtual directory and a real directory. Rename your /wiki/ directory to /mw, /w/ or /mediawiki or whatever. Then use /wiki/$1 as the article path that readers will see.
Then there are no conflicts.
-- Krinkle
You are right...
On Mon, May 28, 2012 at 9:17 AM, Krinkle krinklemail@gmail.com wrote:
On Mon, May 28, 2012 at 2:57 AM, Chee-Yang Chau cychau@gmail.com wrote:
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]
This means you can't have articles with any of these names:
- [[bin]]
- [[docs]]
- [[extensions]]
- [[images]]
- [[languages]]
- [[FAQ]]
- [[Maintenance]]
- [[Tests]]
..and maybe more.
As documented [1], you should never use the same name for a virtual directory and a real directory. Rename your /wiki/ directory to /mw, /w/ or /mediawiki or whatever. Then use /wiki/$1 as the article path that readers will see.
Then there are no conflicts.
-- Krinkle
[1] https://www.mediawiki.org/wiki/Manual:Short_URL _______________________________________________ MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org