Global www removal/redirect?

Igor Sysoev is at rambler-co.ru
Tue Jun 10 14:02:38 MSD 2008


On Tue, Jun 10, 2008 at 09:59:55AM +0100, Phillip B Oldham wrote:

> Is there a quick way to remove the redirect from http://www.* to 
> http://* without listing all the domains? I'm about to point a couple of 
> hundred domains to a box running nginx, and need to remove all the www's 
> from the urls for the app to work.

   server {
       server_name  www.*;

       if ($http_host ~* ^www\.(.+)$) {
           set  $h   $1;
       }

       rewrite   ^   http://$h$request_uri;
   }


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list