Question

How to safely remove old url's server block, wordpress files, and get rid of 301 redirect?

Posted January 1, 2020 1.2k views
WordPress

Old URL successfully redirected for over a year, no longer need it.

Changed the URL of my Wordpress blog a year ago. The old website’s wordpress files and config files remained on my Droplet all the while. No I want to get rid of everything to do with the old URL on my droplet, which includes ending the redirect, removing the URL from DO nameservers, etc.

Can someone please guide me in terms of what to do first, second, etc.? Any words of advice would be appreciated for the absolute novice writing these words.

Thank you very much for your time

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.

×
2 answers

Hi @thankyouDO,

Your task should be easy enough.

Nginx as you know works in blocks. You’ll just need to remove the nginx configuration file of the old domain name you used. Once you do, you can remove the files as well and restart nginx.

This should be it, that’s everything.

Regards,
KDSys

  • Thank you for your help @KDSys,

    Just so I get this right, I just have to remove my old domain from /etc/nginx/sites-enabled and /etc/nginx/sites-available?

    For example:

    1. cd /etc/nginx/sites-enabled
    2. ls
    3. sudo rm oldurlname.com

    4. cd /etc/nginx/sites-available

    5. ls

    6. sudo rm oldurlname.com

    Or does removing it from sites-available count as removing the nginx config file for that old domain?

    Apologies for my greenery in this.

    Thank you

    • Hi @thankyouDO,

      Usually the configuration in the sites-enabled is a symlink and it wouldn’t allow you to use rm on but rather unlink.

      Anyway, you’ve got the general idea behind the situation. Performing the above tasks, should do the trick!

      Regards,
      KDSys

Ubuntu 16.04 using Easy Engine Nginx

Submit an Answer