Question

How long for CNAME record deletetion to take effect

Posted April 19, 2020 475 views
DNS

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.

×
1 answer

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

  • Hi @bobbyiliev

    Yes! I already checked with that tool. And definitely there is no CNAME record.

    In fact I also used [https://developers.google.com/speed/public-dns/cache](http://) to flush cache few times.

    Is there anything else I need to check? All I want now is that my main domain should work without redirecting.

    Many thanks for taking time to help, much appreciated!

    • Hi there @planetMatrix,

      In this case, I believe that the redirect is not caused by the CNAME, you need to make sure that you don’t have any redirect rules in your Apache Vhosts for the new site and also as you are using WordPress, you need to make sure that your WordPress Site and Home URLs are set up correctly for the new site.

      Also make sure that the file permissions and ownership for the new site are set correctly so that Apache has access to them.

      Feel free to share your Apache config files here so that I could advise you further.

      Regards,
      Bobby

Submit an Answer