Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using mediawiki on my localhost server. my url for now is

But i want to convert above mentioned url to wiki. or something like if my wiki is url is

I read this article but not able to achieve it.

They have given how to convert to but using Lighthttpd.

here is the code:

$HTTP["host"] == "" {
server.document-root = "/path/to/webroot"
url.rewrite-once = (
"(^/[^:]*[\./].*)" => "$1",
"^/([^?]*)(?:\?(.*))?" => "/w/index.php?title=$1&$2",

Also i have a website like There i installed wiki to, now i want to port it to

I tried this but it doesn't worked.

With mod_rewrite:

<VirtualHost *:80>
RewriteEngine on
RewriteRule ^/(.*)$1 [R,L]

With mod_alias:

<VirtualHost *:80>
RedirectMatch ^/(.*)$1

But is is not working please, help me out.

share|improve this question

Lighthttpd url.rewrite-once rewrites URLs internally. The Apache configuration code you proposed would serve to redirect, in both cases.

For explanation of lighttpd code:

You actually do not need to do anything special to use instead of . Simply use the ServerName and DocumentRoot directives like for any VirtualHost.

If your MediaWiki files live at /path/to/webroot/wiki, then your DocumentRoot directive would read like the example below:

<VirtualHost *:80>
DocumentRoot /path/to/webroot/wiki


You will also need to add MediaWiki's suggested Apache rewrite code:

With the above code, where uses /path/to/webroot/wiki , you will need to include this rewrite code, either in /path/to/webroot/wiki/.htaccess or in the above VirtualHost block.

RewriteEngine On
RewriteRule ^/?wiki(/.*)?$ /index.php [L]
RewriteRule ^/*$ /index.php [L]
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.