remove www from the url

Jim Ohlstein jim at ohlste.in
Thu Feb 17 18:09:17 MSK 2011


On 2/17/11 10:03 AM, Dayo wrote:
> edogawaconan Wrote:
> -------------------------------------------------------
>> If I remember correctly:
>>
>> server {
>>    server_name www.mysite.com;
>>    rewrite ^ $schema://mysite.com$request_uri
>> permanent;
>> }
>
> Good memory. Not "$schema" though, but "$scheme"
>
> [code]
> server {
> 	server_name www.mysite.com;
> 	rewrite ^ $scheme://mysite.com$request_uri permanent;
> }
> server {
> 	server_name mysite.com;
> 	...
> }
> [/code]

Not to be *too* pedantic, but unless you are using both http and https, 
using $scheme is unnecessary. I only use it for such situations. Without 
having read the code (not that I'd likely understand it anyway), and 
Igor can comment on this, it would seem a waste.


>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,176137,176144#msg-176144
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx


-- 
Jim Ohlstein



More information about the nginx mailing list