2

I need to create a domain alias alias.domain.com to forward http to www.domain.com.

It has to be a forward and not a redirect (I was told it can be done by creating CNAME).

Note I am using Plesk and creating a domain alias in plesk creates an A record not a CNAME.

Any thoughts please?

1

Consider...

bar.example.com.        CNAME  foo.example.com.
foo.example.com.        A      192.0.2.23

Here,

  1. when a DNS resolver encounters a CNAME record while looking for a regular resource record, it will restart the query using the canonical name instead of the original name.
  2. That is when an A record lookup for bar.example.com is done, the resolver will see a CNAME record and restart the checking at foo.example.com and will then return 192.0.2.23.

In Plesk, when we create a domain alias, actually it adds ServerAlias alias.domain.com in vhost configurations of httpd, and hence the A record. Read Here and try relating with this.

As a matter of fact alias.domain.com is resolving directly to pointing IP address, restarting of query is not required is in CNAME.

| improve this answer | |
0

There is no difference between a forward and a redirect. What you mean is probably the function called "Redirection" in Plesk and that function needs to be enabled by your host to show up. If it's not there, ask your hoster to enable it for you.

If Plesk (or your hoster) doesn't help you out, you may need to add this to your root-folder's .htaccess file:

<IfModule mod_rewrite.c>
    RewriteEngine On
    #RewriteBase /
    RewriteCond %{HTTP_HOST} !^alias.domain.com$ [NC]
    RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,QSA,L]
 </IfModule>

If your host gives you 500 error, remove the hash from the third line. That ought to do it.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.