LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   National domains redirect (https://www.linuxquestions.org/questions/linux-server-73/national-domains-redirect-714302/)

axelgenus 03-25-2009 06:18 AM

National domains redirect
 
Hi guys,

I'm hosting some domains on my dedicated server. I'm using Apache to host web sites. One of my costumers asked me to host different national domains and a dot com. He wants to use this kind of redirect pattern:

domain.it -> domain.com/?lang=it
domain.fr -> domain.com/?lang=fr
domain.co.uk, domain.us => domain.com/?lang=en

I guess I have to use the apache rewrite engine... I tried and it works but I would like to implement something elegant and not a dozen of different VirtualHost's directives with the relative rewrite rule.

Any idea?

Idle 04-13-2009 06:55 PM

An idea
 
Wouldn't ServerAlias directives in the base VirtualHost suffice? That is, rather than having "a dozen of different VirtualHost's directives", you'd simply add something along the lines of:
Code:

ServerAlias domain.it domain.fr domain.co.uk
to your <VirtualHost domain.com> section. Furthermore, you could put your RewriteRules in .htaccess.


All times are GMT -5. The time now is 04:27 PM.