You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Samuel Vogel <sa...@gmx.de> on 2007/09/03 18:47:00 UTC

[users@httpd] mod_rewrite question

Hey,

I have 3 domains with various subdomains. The domains are kilu.de, 
kilu2.de and kilu3.de
I want that all requests to [www.]kilu2.de or [www.]kilu3.de are 
redirected to [www.]kilu.de.
Now I'm looking for the best mod_rewrite solution. Here is what I got 
right now:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} ^([^.]+)\.kilu2\.de
    RewriteRule ^(.*)$  http://%1\.kilu.de/$1 [L]

This unfortunately has 2 Problems:
1. It doesn't work at all ;)
2. It would only redirect every subdomain of and only of kilu2.de. But 
only www.kilu2.de and kilu2.de should be redirected and also [www.]kilu3.de!

Any help would be appreciated!

Regards,
Samy

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] mod_rewrite question

Posted by Norman Peelman <np...@cfl.rr.com>.
Samuel Vogel wrote:
> Hey,
>
> I have 3 domains with various subdomains. The domains are kilu.de, 
> kilu2.de and kilu3.de
> I want that all requests to [www.]kilu2.de or [www.]kilu3.de are 
> redirected to [www.]kilu.de.
> Now I'm looking for the best mod_rewrite solution. Here is what I got 
> right now:
>
>    RewriteEngine On
>    RewriteCond %{HTTP_HOST} ^([^.]+)\.kilu2\.de
>    RewriteRule ^(.*)$  http://%1\.kilu.de/$1 [L]
>
> This unfortunately has 2 Problems:
> 1. It doesn't work at all ;)
> 2. It would only redirect every subdomain of and only of kilu2.de. But 
> only www.kilu2.de and kilu2.de should be redirected and also 
> [www.]kilu3.de!
>
> Any help would be appreciated!
>
> Regards,
> Samy
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server 
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
Probably easier to just use ServerAlias

ServerName kilu.de
ServerAlias www.kilu.de kilu2.de www.kilu2.de kilu3.de www.kilu3.de


Norm



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org