Welcome! Log In Create A New Profile

Advanced

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

April 19, 2010 10:26PM
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
> nginx@nginx.org
> http://nginx.org/mailman/listinfo/nginx


--
Jim Ohlstein

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

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

escavern April 19, 2010 10:11PM

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

Jim Ohlstein April 19, 2010 10:26PM

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

Maxim Dounin April 19, 2010 10:26PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 290
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready