Making one of the folders default in Apache
Posted
by OmerO
on Server Fault
See other posts from Server Fault
or by OmerO
Published on 2010-06-11T16:22:22Z
Indexed on
2010/06/11
16:33 UTC
Read the original article
Hit count: 306
Hello,
The file & directory structure of my website is as follows:
/Library/WebServer/mysite/joomla .. /Library/WebServer/mysite/wiki .. /Library/WebServer/mysite/forum .. /Library/WebServer/mysite/index.php
As you see, there are various applications each residing in separate folders.
Now, in order to define this structure, I have made this entry in Apache http-vhosts.config file:
ServerName mysite.com DocumentRoot "/Library/WebServer/mysite" **
And I already have the DirectoryIndex defined: DirectoryIndex index.html index.php, and so on.
So far so good but I want this specific functionality: When someone visits mysite, he/she should automatically directed to:
/Library/WebServer/mysite/joomla
(and therefore /Library/WebServer/mysite/joomla/index.php)
I don't want to achieve that functionality by putting a redirection code inside
/Library/WebServer/mysite/index.php
or
/Library/WebServer/mysite/index.htm
because that causes time delays (because of the redirection, of course)
But in this case, the only proper way of achieving it seems to set DocumentRoot this way:
DocumentRoot "/Library/WebServer/mysite/joomla"
But when I set it that way, then the other folders (/wiki, /forum, etc.) are simply not served by Apache. To work around it, I put directives like:
Alias /wiki /Library/WebServer/mysite/wiki .. Alias /forum /library/WebServer/mysite/forum
and it did work actually the way I wanted.
But... I still cannot use it that way because in this case I just couldn't manage to make the wiki use Short URLs (as described in link text)
So, I have to set the DocumentRoot back to
/Library/WebServer/mysite
and shoud be able to assign
/Library/WebServer/mysite/joomla as the "default directory" (my own terminology :)
Can I do it in Apache? Is there any other way you might suggest?
Thanks.
© Server Fault or respective owner