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

I'm super new to Apache and I am trying to get mutiple sites running on one host; OpenPhoto and ownCloud. I would like mydomain.com/openphoto and mydomain.com/owncloud to point to their respective services. I have them both installed but only they only work with one enabled at a time. My initial thought was to have a VirtualHost for each site but after looking into it I should only do that if I have separate DNS entries for each host.

I think using aliases is what I need. I don't quite understand what I need to change in the OpenPhoto VirtualHost entry to get the aliases to work. Note: ownClod didn't come with a VirtualHost configuration, it's just a php page that works. I would like to be able to add other sites in the future also.

Here is the open photo VirtualHost:

<VirtualHost *:80>
DocumentRoot /var/www/openphoto/src/html
ServerName yourdomainname.com`

RewriteEngine on
RewriteCond %{HTTP_HOST} !^yourdomainname.com$
RewriteRule ^.*$ http://yourdomainname.com [R,L]

<Directory "/var/www/openphoto/src/html">
Order deny,allow
Allow from all

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?__route__=/$1 [L,QSA]

# 403 Forbidden for ini files
#RewriteRule \.ini$ - [F,NC]

AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/x-javascript
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# 404 Not Found for ini files
AliasMatch \.ini$     /404

ExpiresActive On
ExpiresByType text/javascript "A31536000"
ExpiresByType application/x-javascript "A31536000"
ExpiresByType text/css "A31536000"
ExpiresByType image/x-icon "A31536000"
ExpiresByType image/gif "A604800"
ExpiresByType image/jpg "A604800"
ExpiresByType image/jpeg "A604800"
ExpiresByType image/png "A604800" 

Header set Cache-Control "must-revalidate"
FileETag MTime Size
share|improve this question
what's preventing you from just doing a header("Location: opencloud.com); and saving all the configuration? –  nageeb Dec 4 '12 at 21:17
Probably nothing. I'm mostly trying to learn how things work in the Apache world. So basically you're saying if I use a header I can force Apache to see the request as if they were coming from another DNS entry? –  user1661890 Dec 5 '12 at 1:21
Maybe I'm misunderstanding your request, but what I'm suggesting is if people visit yoursite.com/opencloud, instead of aliasing and messing around with apache, the simpler solution would be just to redirect to the actual site. –  nageeb Dec 5 '12 at 20:55

Your Answer


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

Browse other questions tagged or ask your own question.