Welcome! Log In Create A New Profile

Advanced

Re: remove www from the url

February 17, 2011 10:08AM
Thank you all. Your solutions seem quite elegant.

Just a note, I was hoping for something I can do inside the server only declaration, just like I can do with the opposite redirection mysite.com --> www.mysite.com:

[code]
server {
server_name www.mysite.com mysite.com;

if ($host !~* www\..*) {
rewrite ^(.*)$ http://www.$host$1 permanent;
}
[/code]

On the other hand, I feel your solution with the two server declaration can even be a bit faster (not to mention easy to understand). Your solution suggests I should rewrite the above code into two server declarations as well.

Thank you very much!
Jiri
Subject Author Posted

remove www from the url

whiskybar February 17, 2011 09:44AM

Re: remove www from the url

Jim Ohlstein February 17, 2011 09:52AM

Re: remove www from the url

edogawaconan February 17, 2011 09:52AM

Re: remove www from the url

Luit van Drongelen February 17, 2011 09:54AM

Re: remove www from the url

Dayo February 17, 2011 10:03AM

Re: remove www from the url

Jim Ohlstein February 17, 2011 10:12AM

Re: remove www from the url

Dayo February 17, 2011 10:34AM

Re: remove www from the url

whiskybar February 17, 2011 10:08AM

Re: remove www from the url

Igor Sysoev February 17, 2011 10:18AM

Re: remove www from the url

Francis Daly February 17, 2011 10:54AM

Re: remove www from the url

whiskybar February 17, 2011 11:15AM

Re: remove www from the url

Francis Daly February 17, 2011 06:46PM

Re: remove www from the url

lifeisjustabout February 17, 2011 11:31PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 139
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