Subdomain error: server DNS address could not be found
Ok so based on your screenshot, you have 2 different URLs for your website, the possible host headers you could use would be:
htmltest.mydomain.com
www.mydomain.com
This is not what you want though, you want:
www.htmltest.mydomain.com
So you should delete the first two (unless you want to keep them, which is perfectly valid), and add www.htmltest.mydomain.com
as an A
record with the appropriate IP address.
Just a word of caution though, you may need to check with your hosting provider; sometimes simply adding a host record as above (with the subdomain) may not be all that is required to make this work. As I don't know your hosting provider, I cannot say for sure, but generally this approach will work.
Related videos on Youtube
Михаил Павлов
Updated on September 18, 2022Comments
-
Михаил Павлов almost 2 years
I'm trying to add subdomain to my domain. I just installed httpd on my clean centos 7. At first I created file /etc/httpd/conf.d/htmltest.mydomain.com.conf with the following contents:
<VirtualHost *:80> # Admin email, Server Name (domain name), and any aliases ServerAdmin [email protected] ServerName htmltest.mydomain.com DirectoryIndex index.html index.php DocumentRoot /www/sites/htmltest.mydomain.com/htdocs # Log file locations LogLevel warn ErrorLog /www/sites/htmltest.mydomain.com/log/error.log CustomLog /www/sites/htmltest.mydomain.com/log/access.log combined </VirtualHost> <Directory "/www/sites/htmltest.mydomain.com/htdocs"> Options Indexes FollowSymlinks AllowOverride None Require all granted </Directory>
Also /www/sites/htmltest.mydomain.com/htdocs folder was created with index.html file inside. With this configuration my attempt to access htmltest.mydomain.com gives 'server DNS address could not be found' error in the browser. But mydomain.com opens htmltest subdomains index.html. In my hosting CP dns settings there is mydomain.com with the htmltest 'A' record pointing to server IP, along with the www record. How can I fix this?
UPD: I've changed domain to use vultr nameservers, and it works properly now.
-
Coding Gorilla over 8 yearsCan you post a screenshot of the DNS entries from your hosting CP? I'm having a hard time understanding how you have that set up without being able to see it. But it sounds like you have two
A
records:htmltest.mydomain.com
andwww.mydomain.com
where you want a singleA
record:www.htmltest.mydomain.com
. -
Михаил Павлов over 8 years@CodingGorilla, please see attached screenshot
-
-
Михаил Павлов over 8 yearsthank you for your help, I've changed domain to use hosting nameservers, and it works properly now.
-
Михаил Павлов over 8 yearsRight now subdomains are working as they should, but www prefix points to one of my subdomains, how can I alias www to second-level domain? Do I need to create www.domain.com.conf file or there is another way to alias?