{"id":16232,"date":"2024-05-20T16:21:37","date_gmt":"2024-05-20T16:21:37","guid":{"rendered":"https:\/\/hostvento.com\/kb\/web-hosting\/getting-started-guide\/shared-hosting-quick-start-guide\/how-to-add-a-wildcard-dns-record\/"},"modified":"2024-06-15T03:22:59","modified_gmt":"2024-06-15T03:22:59","slug":"how-to-add-a-wildcard-dns-record","status":"publish","type":"docs","link":"https:\/\/www.hostvento.com\/kb\/docs\/hosting-faqs\/how-to-add-a-wildcard-dns-record\/","title":{"rendered":"How to add a wildcard DNS record"},"content":{"rendered":"\n<p>Any subdomain that uses wildcard DNS will redirect to your main domain.<br>For instance, when set, mydomain.com will be the default website for anyone inputting subtest.mydomain.com or subtest123.mydomain.com.<br>When ww is typed incorrectly, it can also be used to reroute searches like ww.mydomain.com to www.mydomain.com.<br>One of three methods can be used to set up a WildCard subdomain:<\/p>\n\n\n\n<p>1.\u00a0Setting it from\u00a0<strong>cPanel<\/strong><br>2. Setting it from\u00a0<strong>WHM<\/strong><br>3. Setting it from\u00a0<strong>httpd.conf<\/strong><\/p>\n\n\n\n<p><em><strong>1.\u00a0Setting it from cPanel<\/strong><\/em><br>a. Log into your cPanel<br>b. Go to Subdomains<br>c. Add subdomain * in the box next to the field \u2018<strong>Subdomain\u2019\u00a0<\/strong>of your primary domain. Make sure that the Document Root is set to\u00a0<strong>public_html\u00a0<\/strong>folder.<br>While adding Wildcard subdomain to your Addon domain, you just need to be sure to set the Document Root to that of the Addon Domain and not the primary domain.<\/p>\n\n\n\n<p><em><strong>2. Setting it from WHM<\/strong><\/em><\/p>\n\n\n\n<p>If you have access to WHM, then you need to<br>a. Go to\u00a0<strong>Edit DNS Zone<\/strong><br>b. Select the required domain<br>c. Under\u00a0<strong>Add New Entries Below this Line\u00a0<\/strong>insert as below<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img decoding=\"async\" src=\"https:\/\/www.hostvento.com\/kb\/hosting-faqs\/wp-content\/uploads\/2015\/12\/wildcarddns-300x23.png\" alt=\"wildcarddns\" class=\"wp-image-2324\" style=\"width:950px;height:auto\"\/><\/figure>\n<\/div>\n\n\n<p>NOTE: Please replace 20.x.xx.xx with the actual IP of the account.<\/p>\n\n\n\n<p><em><strong>3. Setting it from httpd.conf<\/strong><\/em><br><strong>\u00a0<\/strong>In order to use this method, you need root access to the server.<br>a. Login as root<br>b. Edit\u00a0<strong>httpd.conf \u00a0<\/strong>(commonly located at \/etc\/httpd\/conf)\u00a0with your favorite text editor such as Vim or Nano and go to the VirtualHost entry of the domain\/website.<\/p>\n\n\n\n<p><em>&lt;VirtualHost 20.x.xx.xxx:80&gt;<\/em><br><em>ServerName&nbsp;mydomain.com<\/em><br><strong><em>ServerAlias www.mydomain.com<\/em><\/strong><br><em>DocumentRoot \/home\/mydomain\/public_html<\/em><br><em>ServerAdmin webmaster@mydomain.com<\/em><br><em>UseCanonicalName Off<\/em><br><em>CustomLog \/usr\/local\/apache\/domlogs\/mydomain.com combined<\/em><br><em>CustomLog \/usr\/local\/apache\/domlogs\/mydomain.com-bytes_log \u201c%{%s}t %I .\\n%{%s}t %O .\u201d<\/em><\/p>\n\n\n\n<p>c. The line&nbsp;<strong><em>ServerAlias www.mydomain.com&nbsp;<\/em><\/strong>is of your interest. Simply replace<em>&nbsp;<strong>www&nbsp;<\/strong><\/em>with&nbsp;<em><strong>*&nbsp;<\/strong><\/em>which should look like&nbsp;<strong><em>ServerAlias&nbsp;<\/em><em>*<\/em><em>.mydomain.com<\/em><\/strong><\/p>\n\n\n\n<p><em>That\u2019s it !<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Any subdomain that uses wildcard DNS will redirect to your main domain.For instance, when set, mydomain.com will be the default website for anyone inputting subtest.mydomain.com or subtest123.mydomain.com.When ww is typed incorrectly, it can also be used to reroute searches like ww.mydomain.com to www.mydomain.com.One of three methods can be used to set up a WildCard subdomain: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":23377,"menu_order":1041,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-16232","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/16232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/comments?post=16232"}],"version-history":[{"count":2,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/16232\/revisions"}],"predecessor-version":[{"id":16235,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/16232\/revisions\/16235"}],"up":[{"embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/docs\/23377"}],"wp:attachment":[{"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/media?parent=16232"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/www.hostvento.com\/kb\/wp-json\/wp\/v2\/doc_tag?post=16232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}