Redirect old domain to new domain

Hi,

I have an old domain & new domain, let’s call the old domain is
www.olddomain.com and the new one is www.newdomain.com.
Yesterday, I’ve register the new domain (www.newdomain.com), but, the
olddomain.com still active. Both of them can be accessed by user. But,
in
some direction (nginx.conf), i’ve limit the old domain can accessed some
directory, but the new domain can access all directory in public_html.

Could nginx make a rules, if the user access the site from
olddomain.com,
for example, the user access a file from www.olddomain.com/file.exe,
will be
redirected automatically to Parked at Loopia. NginX Wiki
doesn’t
provide this documentation. :frowning:

Thanks,
antituhan

View this message in context:
http://nginx.2469901.n2.nabble.com/ASK-Redirect-old-domain-to-new-domain-tp5894964p5894964.html
Sent from the nginx mailing list archive at Nabble.com.

On 1/6/11 4:46 AM, antituhan wrote:

Could nginx make a rules, if the user access the site from olddomain.com,
for example, the user access a file from www.olddomain.com/file.exe, will be
redirected automatically to Parked at Loopia. NginX Wiki doesn’t
provide this documentation. :frowning:

server {
listen 80;
server_name www.olddomain.com;
rewrite ^ http://newdomain.com$request_uri? permanent;
}

Thanks,
antituhan


Jim O.

Hi jim,

thank you very much :slight_smile:
works like a charm :slight_smile:

View this message in context:
http://nginx.2469901.n2.nabble.com/ASK-Redirect-old-domain-to-new-domain-tp5894964p5895783.html
Sent from the nginx mailing list archive at Nabble.com.

On 1/6/11 4:59 AM, Jim O. wrote:

rewrite ^ http://newdomain.com$request_uri? permanent;
}

  • rewrite ^ http://newdomain.com$request_uri? permanent;
  • rewrite ^ http://www.newdomain.com$request_uri? permanent;

Thanks,
antituhan


Jim O.