J'ai 2 domains hosted avec différent hosts. J'ai besoin de to redirect Domain A to Domain B. Unfortunately Je ne peux pas do a 301 redirect depuis Host A, mais can seulement modify/add DNS entries (A-Records et CNAMEs) at Host A.
Surely it is possible to redirect www.DomainA.com to www.DomainB.com using seulement A-records et CNAMEs?
At present, le DNS entries are:
```
DomainA.com. 3600 IN SOA ns1.HostA.net.
www 3600 IN CNAME www.DomainB.com.
DomainA.com. 3600 IN NS ns1.HostA.net.
DomainA.com. 3600 IN NS ns2.HostA.net.
DomainA.com. 3600 IN NS ns3.HostA.net.
```
Je veux to redirect
```
DomainA.com -> DomainB.com
*.DomainA.com -> *.DomainB.com
```
J'ai tried le suggestion depuis this [other post](https://serverfault.com/questions/207705/domain-a-to-domain-b-cname-mapping) mais it didn't work.
How can I achieve this seulement avec A-Records et CNAMEs please? Thank you for votre advice.
Prembo.
Comment rediriger le domaine A vers le domaine B en utilisant uniquement des enregistrements A et CNAME
Re: Comment rediriger le domaine A vers le domaine B en utilisant uniquement des enregistrements A et CNAME
So you are pas looking at redirection as such (as that happens at le app level, i.e. on Apache/Nginx/wherever) mais plutôt on le DNS resolution. The host on qui DomainA is hosted will ou should jamais be hit, based on votre description as you want le DNS requests to be resolved to le IPs of DomainB. Unless Je suis missing something in votre request?
As Shane pointed out DNS is pas capable of HTTP redirection - c'est an application/webserver duty. You could make DomainA et DomainB resolve to le même IP on DNS et tous would work. But si you're looking to do this on per URL/per-path way alors this is pas possible - DNS is pas capable of that - c'est a simple DNS->IP service, quel est happening avec le actual URL is le webserver's task.
After le comment below, what J'aimerais do is to refer tous DNS records for DomainA to le même IP(s) as DomainB is pointed to - this way you will get HTTP request hitting hostB et alors c'est juste a simple matter of:
- creating a particular Apache Name Baseed Virtual host - qui will be serving files depuis its own DocumentRoot
- creating permanent redirect on Apache like this:
Cela va rewrite anything coming to DomainB to DomainA qui can be hosted on le même server ou somewhere else. I appreciate that le second option is probably an overhead et pas nécessaire si you can/are allowed to create Name Based Virtual hosts on apache.
```
ServerName DomainB
Redirect permanent / http://DomainA/
```
J'aimerais go avec 1. - point tous DNS records of DomainA to le même IP(s) as DomainB is pointing et create particular Name Based VirtualHosts on Apache.
As Shane pointed out DNS is pas capable of HTTP redirection - c'est an application/webserver duty. You could make DomainA et DomainB resolve to le même IP on DNS et tous would work. But si you're looking to do this on per URL/per-path way alors this is pas possible - DNS is pas capable of that - c'est a simple DNS->IP service, quel est happening avec le actual URL is le webserver's task.
After le comment below, what J'aimerais do is to refer tous DNS records for DomainA to le même IP(s) as DomainB is pointed to - this way you will get HTTP request hitting hostB et alors c'est juste a simple matter of:
- creating a particular Apache Name Baseed Virtual host - qui will be serving files depuis its own DocumentRoot
- creating permanent redirect on Apache like this:
Cela va rewrite anything coming to DomainB to DomainA qui can be hosted on le même server ou somewhere else. I appreciate that le second option is probably an overhead et pas nécessaire si you can/are allowed to create Name Based Virtual hosts on apache.
```
ServerName DomainB
Redirect permanent / http://DomainA/
```
J'aimerais go avec 1. - point tous DNS records of DomainA to le même IP(s) as DomainB is pointing et create particular Name Based VirtualHosts on Apache.