View Single Post
  #3  
Old 9th July 2013, 14:35
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,741 Times in 2,575 Posts
Default

www to non-www:

Code:
if ($http_host != "example.com") {
  rewrite ^ $scheme://example.com$request_uri? permanent;
}
non-www to www:

Code:
if ($http_host != "www.example.com") {
  rewrite ^ $scheme://www.example.com$request_uri? permanent;
}
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote