Want to change the domain name

Posted August 16, 2017 7.8k views
Configuration Management

How do I change the domain name on my website.

So currently my domain is and I would like to change it to - the rest of the site stays the same.

In addition - do I need to

  • Buy a new certificate for
  • set up page level redirects or can this be done at domain level?


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.

Submit an Answer
1 answer

You will need to buy a new SSL certificate since those are issued at the domain level. Depending on your needs, you might want to just use LetsEncrypt. I use it for all my sites and have never had a problem (and it’s free!).

As for the redirects, your web server can handle that at the domain level. For example, in nginx you can do this in the server block:

server {
    listen 80;
    rewrite      ^$request_uri? permanent;

If I remember correctly, this performs a redirect on the server side, rather than giving a 301 to the client. I’m not an Apache guy so I don’t know the syntax offhand, but I do know there’s a similar way to do the same thing.

Here’s a really good guide if you’re interested in the finer details:

by Mateusz Papiernik
HTTP redirection is a way to point one domain or address to another. There are a few different kinds of redirects (301 Moved Permanently and 302 Found), each of which mean something different to the client browser. You can add a redirect with `rewrite ^/$ redirect;` or `rewrite ^/$ permanent;` in your server configuration. This guide will cover a more in depth explanation of how to implement each kind of redirect in Nginx.