The issue of one.com not accepting the same IP address for the A record of 2 domains to me suggests the provider has a slightly odd or bespoke setup, and this limitation is in their control panel, and not the capability of their server to manage 2 domains on one IP address. I manage large numbers of domains on single IP addresses without any problems, perhaps the way they have designed their system you may have to register two separate hosting accounts to achieve this? Sometimes it helps to register and manage your domain names with a different provider to your web hosting. Decent domain name providers will give you all the options for DNS records.
Web Aliases, Parked Domains, Add-on Domains, etc do not normally redirect HTTP requests but are simply configurations which identify the server the request needs to be sent to. Say for example if an alias had been setup for example.com
, "you can find me at the same address as example.de
", and this is normally achieved using a CNAME
DNS record.
.htaccess rules process incoming HTTP requests and can redirect them to another URL amongst other capabilities.
Some people really prefer to use CNAME
's wherever possible while others tend to avoid them. There are pros and cons for each case, though my preference is to use A
records as they offer me greater flexibility.
One solution you could use in this circumstance, might be:
Setup A
record pairs (@
, www
) for both example.com
and example.de
to point to the IP address of your web server.
example.com IN A 001.002.003.004
example.de IN A 001.002.003.004
www.example.com IN A 001.002.003.004
www.example.de IN A 001.002.003.004
Use .htaccess rules to ensure all inbound HTTP requests are 301 redirected to the appropriate URL's as required:
# Redirect http://domain.com/* to http://www.domain.de/en/*
RewriteCond %{HTTP_HOST} ^domain.([^.]+).com$ [NC]
RewriteRule (.*) http://www.%1.de/en/$1 [R=301,L)
# Redirect http://www.domain.com/* to http://www.domain.de/en/*
RewriteCond %{HTTP_HOST} ^www.domain.([^.]+).com$ [NC]
RewriteRule (.*) http://www.%1.de/en/$1 [R=301,L)
# Redirect http://domain.de/* to http://www.domain.de/*
RewriteCond %{HTTP_HOST} ^([^.]+).de$ [NC]
RewriteRule (.*) http://www.%1.de/$1 [R=301,L)
A
record to your server is not going to work, since the server is not going to know to accept requests directed to that host. So, by "work" I assume you mean that you seeexample.com
in the address bar and the content fromexample.de
is served? In this case, the .htaccess directives you've posted should work? (The first dot in theRewriteCond
pattern should be escaped, but that is not a show stopper.)