Hello,
I wanted to create a subdomain but hurriedly added a CNAME Alias pointing main domain to the subdomain. Once realized I deleted that record. Now its been more than 72 hours but the main domain still redirects to subdomain. Extra information: I created VHost for subdomain and had a WordPress running on it. After deleting CNAME I deactivated the subdomain Vhost by a2dissite.
Conf of my domain
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin email@example.com
DocumentRoot /var/www/example.com/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
RewriteEngine on
RewriteCond %{SERVER_NAME} =example.com [OR]
RewriteCond %{SERVER_NAME} =www.example.com
RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent]
<Directory /var/www/example.com/public_html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</Directory>
</VirtualHost>
and of my subdomain
<VirtualHost *:80>
ServerName sub.example.com
ServerAlias www.sub.example.com
ServerAdmin email@example.com
DocumentRoot /var/www/example.com/sub
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Click below to sign up and get $100 of credit to try our products over 60 days!
Hi there @planetMatrix,
I would recommend checking your DNS Records via this tool here:
https://www.digitalocean.com/community/tools/dns
That way you should be able to tell if the DNS record is still present. Note that it could actually take up to 72 hours for the DNS cache to clear over the Globe before you could see the changes.
But besides that, if you want to create a new website with your subdomain name, what I would suggest is just adding a new DNS A record for your subdomain name and then creating a new Vhost for your subdomain name. Then once the DNS propagates you should be able to see your website via your subdomain name as expected.
Let me know if you have any questions. Regards, Bobby