Redirecting old domain to new domain on NGINX ubuntu.. Please help if you can

  • Thread starter Thread starter Deleted member 1333509
  • Start date Start date
D

Deleted member 1333509

Guest
I'm 90% of the way through changing the domain name of a site that I run, and the new domain is working fine.

I'm in the process of redirecting the old domain to the new domain in order to retain SEO.

I'm using nginx on ubuntu 16.04.

I've got two server blocks, one for each domain.. can anyone advise on the code needed to be placed in the old domain's server block to redirect optimally for SEO?

There seems to be a bunch of different ways, thanks!
 
Are you doing 301?

I used to redirect them with:

Code:
server {
    listen 80;
    listen 443 ssl;
    server_name www.olddomain.com olddomain.com;
    rewrite 301 https://newdomain.com$request_uri;
}
The file you edit:

/etc/nginx/sites-available/directory_name.conf.
 
Yeah 301. Thanks for that.

Should I be deleting all of the other location blocks within the server block as well? ie. get rid of everything apart from this snippet?
 
do it from the domain provider .

i use the domain provider to do a 301 as i fill it safer and works better .
 
do it from the domain provider .

i use the domain provider to do a 301 as i fill it safer and works better .

This would be good except for this at name.com (where it's held)..

"We can forward subdomains and domains, however, we do not support—nor have the ability to—forward anything after the domain, such as folders or /.
For example, we CAN forward "contact.domain.com" but we CANNOT forward "domain.com/contact."\

I need a whole website forwarded not just the homepage
 
Back
Top