[ASK] Redirect old domain to new domain

Jim Ohlstein jim at ohlste.in
Thu Jan 6 12:59:49 MSK 2011

On 1/6/11 4:46 AM, antituhan wrote:
> 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 www.newdomain.com/file.exe. NginX Wiki doesn't
> provide this documentation. :(

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

> Thanks,
> antituhan

Jim Ohlstein

More information about the nginx mailing list