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

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

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,76883,76883#msg-76883

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 D.

On 4/19/10 10:11 PM, 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 hostname.com;

}

server (
listen 80;
server_name www.myhostname.com;
rewrite ^ http://hostname.com$request_uri? permanent;
}

This assumes you want a redirect to the requested URI. If you want all
requests to go to the index page for http://hostname.com omit
“$request_uri?” from the rewrite.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,76883,76883#msg-76883


nginx mailing list
[email protected]
http://nginx.org/mailman/listinfo/nginx


Jim O.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs