Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 3 > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 2nd July 2013, 14:52
jaypabs jaypabs is offline
Member
 
Join Date: Jun 2013
Posts: 68
Thanks: 0
Thanked 1 Time in 1 Post
Default Non-www to www and vice versa

How can I rewrite nginx to redirect non-www to www and vice versa?

I have tried the following by adding it in the nginx directives without luck.

non-www to www:
Code:
	server {
		server_name example.com;
		rewrite ^(.*) http://www.example.com$1 permanent;
	}
www to non-www:
Code:
	server {
		server_name www.example.com;
		rewrite ^(.*) http://example.com$1 permanent;
	}
Reply With Quote
Sponsored Links
 

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:33.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.