how to redirect user from www.myhostname.com to hostname.com

Maxim Dounin mdounin at mdounin.ru
Tue Apr 20 06:23:07 MSD 2010


Hello!

On Mon, Apr 19, 2010 at 10:11:13PM -0400, escavern wrote:

> how to redirect user from http://www.myhostname.com to http://hostname.com ??
> i mean if they access http://www.myhostname.com he will be redirected to http://hostname.com
> pls help me

server {
    listen 80;
    server_name www.myhostname.com;

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

Maxim Dounin



More information about the nginx mailing list