Domain Forwarding and Redirect for non cPanel Servers

Since domain forwarding and/or redirection is commonly misunderstood this writeup should help to pinpoint which
method should be used and why. We should begin with DNS as if the DNS authority for the domain or the ip address
for the domain is pointing outside our network (and control) then the forwarding or redirection must be handled
elsewhere
as well:

1. Forwarding (or pointing) using DNS Nameservers:

a. Our DNS Nameservers are authoritative for the domain - If this is the case and the client requires that we maintain DNS for the domain the IP Address for the A record of the domain and www.domain.ext may be assigned the IP address of wherever the domain is hosted, provided they have that domain setup in their webserver configuration (could be parked in cPanel or an Addon domain or a separate Account, same with various control panel systems). If this is the case the client would simply need to contact us and request a DNS update and provide the IP Address for the domain to be sent to.

b. Domain is registered through SimplicityHosting.Com, Inc. but client wishes to send it's DNS to another hosting provider - If this is the case the client should either modify the Nameservers for the domain or open a support ticket providing the nameservers to be updated to for that domain.

2. Redirection - Redirection is necessary when the domain is using our DNS and servers for hosting which are not cPanel based and the client desires (for any number of reasons) to have the web browser requests for that domain sent to another site identified by another domain. The client should setup the domain in question as a normally hosted domain and then modify .htaccess to have it Redirected in the following manner:

There are 2 basic methods with 2 basic variations. This also mimicks what is called a Redirect using cPanel. The following are examples of Permanent and Temporary Redirection using wildcard and non-wildcard for fromdomain.com to todomain.com. The only time wildcard should be used is if the previous fromdomain.com's site already has well established links that will be duplicated and used on the todomain.com. So to preserve those links they will be redirected entirely. Otherwise non wildcard would be preferred:

The following modifications/additions to .htaccess will accomplish this:

Permanent (301)

Regular (both domain and with www)

RewriteCond %{HTTP_HOST} ^fromdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.fromdomain.com$
RewriteRule ^/?$ "http\:\/\/www\.todomain\.com" [R=301,L]

Wildcard (both domain and with www)

RewriteCond %{HTTP_HOST} ^fromdomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.fromdomain\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.todomain\.com\/$1" [R=301,L]


Temporary (302)

Regular (both domain and with www)

RewriteCond %{HTTP_HOST} ^fromdomain.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.fromdomain.com$
RewriteRule ^/?$ "http\:\/\/www\.todomain\.com" [R=302,L]


Wildcard (both domain and with www)


RewriteCond %{HTTP_HOST} ^fromdomain\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.fromdomain\.com$
RewriteRule ^(.*)$ "http\:\/\/www\.todomain\.com\/$1" [R=302,L]


As usual if the above example do not suffice or if there are questions on the operation or an error please open a ticket with support.
  • 79 Usuários acharam útil
Esta resposta lhe foi útil?

Artigos Relacionados

How To Flush DNS Cache

Flush dns to get a new name resolution. Or if a domain is not resolving for you but is fine for...