Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm using CentOS 5.5 and Apache 2.2. I just started to administrate my own dedicated server, but I think that I understand the concept of virtual hosts in Apache: I actually have to different domains (lets call em: www.myDomain1.com and www.myDomain2.com) that are both served by my server.

Now I want to use Mediawiki and would like to use it with the following Url: www.myDomain1.com/wiki. How to I do that? As far as I understand, virtual hosts are only for complete domains, but I only want "www.myDomain1.com/wiki" to serve my wiki-webpage. Here are some important information:

  • DocumentRoot is "/var/www"
  • "/var/www" contains three more folders: myDomain1, myDomain2, Mediawiki
  • I use the Kohana Framework on both domains, which usually catches all requests and wants to map them to one of its contollers
share|improve this question

1 Answer 1

up vote 0 down vote accepted

Apache is very flexible and there are multiple choices of how to do this:

  1. In /var/www, create a symlink so that wiki is an alias for Mediawiki. `ln -s /var/www/Mediawiki /var/www/wiki
  2. Alias /wiki /var/www/Mediawiki in your apache config (inside the virtualhost). This is primarily intended for things outside the document root (/var/www), but works inside, too; and it's both fast and simple.
  3. mod_rewrite. Very flexible, can do a lot of things. Also complicated.

    RewriteEngine On
    RewriteRule ^/wiki(.*)$ /Mediawiki$1

share|improve this answer
    
Thx for the fast response! –  paskster Dec 12 '10 at 2:15
    
Where to I put the Rewrite code? Can I put it somewhere in my httpd.conf (where exactly?) or do I need tu put it in an .htaccess file? –  paskster Dec 12 '10 at 21:15
    
If you've got a VirtualHost, put it in there. Other than that, it'll work in httpd or in a .htaccess file in /var/www –  freiheit Dec 13 '10 at 5:21

Your Answer

 
discard

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.