Question about redirecting example for forcing a host name

Fred Palmer fred at
Tue Aug 28 20:12:47 MSD 2007

I found an Nginx example for forcing the host name and wanted to know if
this is the best way to do it.  Basically I have several domains, some are
misspellings of our primary domain and we want them to all go to our primary
domain.  So I found this example:

server {
  listen 80;

  if ($host != '' ) {
      rewrite  ^/(.*)$$1  permanent;

Is this the best way?

Fred Palmer | Senior Software Engineer
615.653.7228 |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list