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 trying to get domain.fi and domain.com to point to the same DocumentRoot, without the domain changing in the browser url. Is that possible with Apache?

I've got the both domains pointing to the same DocumentRoot and working, but the domain.com changes to domain.fi in the browser url.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Use a Redirect to domain.com within the VirtualHost for domain.fi. For this to work mod_alias must be loaded.

<VirtualHost 127.0.0.1>
        ServerName www.domain.fi
        ServerAlias doman.fi
        RedirectMatch (.*) http://www.domain.com/
</VirtualHost>

You could also specify any standard VirtualHost settings desired, such as CustomLog.

share|improve this answer
    
Thank you. That seemed to fix the url problem, but I forgot to tell that the server uses https protocol only, so now the browser warns about an untrusted ssl certificate.. (naturally because the .com url has now the .fi certificate) I'm just trying to get the two domains to point to the same DocumentRoot and work with ssl, but is it possible? –  Jukka Mar 26 '10 at 22:16
    
Are you linking the different URL within your site? I don't understand why the Redirect would introduce a SSL error. I need more details. What's the actual domain? –  Warner Mar 26 '10 at 22:26
    
No, I'm not linking the URLs. I just need the site to work with both domains when users visit them. I can't tell the actual domain yet, because it hasn't been published yet.. The SSL error comes with the URL www.domain.com but not with domain.com. Our domain.fi and domain.com have different SSL sertificates. –  Jukka Mar 26 '10 at 22:39
    
You should be able to setup a https vhost for www.domain.fi and redirect it to domain.com. If the CN in the cert matches both vhosts, you shouldn't get SSL errors. –  Warner Mar 27 '10 at 3:35
    
The CN only matches one vhost. If we would buy a cert that matches both domains, it would cost a lot more.. So I guess for now we can only use one domain, and just redirect from .fi to .com domain. Thanks for your help. –  Jukka Mar 28 '10 at 11:44

Your Answer

 
discard

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