: Redirecting www.foo.example.com to foo.example.com I have a Cpanel web hosting account and have created a subdomain which redirects to an IP address of a different server (Windows IIS) by creating
I have a Cpanel web hosting account and have created a subdomain which redirects to an IP address of a different server (Windows IIS) by creating an A record. I don't have control of the Windows server.
I would like that those people who type before the subdomain get redirected to the same page.
I tried creating a CNAME record pointing foo.example.com. to foo.example.com but it isn't working. It is actually stopping the A record from working.
How do I redirect foo.example.com. to foo.example.com in Cpanel?
More posts by @Ann8826881
2 Comments
Sorted by latest first Latest Oldest Best
You can follow these 2 steps in order to achieve the same.
Step 1) Delete the CNAME record that is redirecting(at the DNS Level) foo.example.com to foo.example.com.
In order to do this, You will have to log-in to the Advanced DNS Zone editor present in your cPanel and delete the following CNAME record: foo.example.com IN CNAME foo.example.com.
Step 2) You will have to add an A record pointing foo.example.com pointing to the concerned IP address.(IPv4 or IPv6).
The A record will be similar to this:
foo.example.com IN A x.x.x.x
where x.x.x.x is the IP address assigned by your web hosting provider.
Your cPanel may have an interface to do that for you. What needs to be done, which is what such interface would do anyway, is modifying the .htaccess file in your public_html directory. It will add the following lines:
RewriteEngine ON
RewriteCond %{HTTP_HOST} ^www.foo.example.com$
RewriteRule ^/?(.*)$ foo.example.com/ [R=301,L]
Omit the RewriteEngine ON line if it is already there.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.