On Tue, Nov 8, 2011 at 3:19 PM, Lukas C. C. Hempel <lukas.hem...@me.com> wrote:
> Hi there,
>
> I have a problem with an htaccess file.
>
> I own three domains: example.com, example.de and example.net. They all refer 
> to the same webhosting space (= alias domains).
>
> What I have succeeded in is that when I enter example.com or example.de it 
> refers to www.example.de. I did that with that entry in the .htaccess file:
>
> # Enforce www
> RewriteCond %{HTTP_HOST} !^(www) [NC]
> RewriteRule ^(.*)$ http://www.example.de/$1 [L,R=301]
>
>
> What I want to add, is that when I enter www.example.com or www.example.net, 
> I get forwarded to www.example.de? Can anyone come up with a code for that?
>
>
> Thank you for your anticipated help.
>
> Best regards,
>
> Lukas
>
> ---------------------------------------------------------------------
> 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-unsubscr...@httpd.apache.org
>   "   from the digest: users-digest-unsubscr...@httpd.apache.org
> For additional commands, e-mail: users-h...@httpd.apache.org
>
>

Well, so, if you don't care about the www prefix anymore, then just
change your RewriteCond (my syntax is probably not optimal) to
something like this.  It seems like all you care about here is that
the hostname contains something dot example dot something, right?
Either that or I guess if you want to list it out precisely you could
chain the conditions together to rewrite on ^*.example.de or
^*.example.com or ^*.example.net.

 RewriteCond %{HTTP_HOST} ^*.example.* [NC]
 RewriteRule ^(.*)$ http://www.example.de/$1 [L,R=301]

---------------------------------------------------------------------
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-unsubscr...@httpd.apache.org
   "   from the digest: users-digest-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to