Welcome Guest. Please Login or Register  


You are here: Index > Webuzo > General Support > Topic : Nginx: How to Redirect non-www to www for specified doman?



Threaded Mode | Print  

 Nginx: How to Redirect non-www to www for specified doman? (4 Replies, Read 63313 times)
ewwink
Group: Member
Post Group: Newbie
Posts: 23
Status:
Hello,

I need to redirect from non-www to www, where or how should I insert the following lines

Code
server {
    listen      80;
    server_name  example.com;
    return      301 http://www.example.com$request_uri;
}

server {
    listen      80;
    server_name  www.example.org;
    ...
}

IP: --   

Nginx: How to Redirect non-www to www for specified doman?
valley
Group: Webuzo Team
Post Group: Super Member
Posts: 1644
Status:
You can try this guide:

http://stackoverflow.com/questions/7947030/nginx-no-www-to-www-and-www-to-no-www

-----------------------
Webuzo : Single User Control Panel
Join Webuzo :
Facebook
Twitter

IP: --   

Nginx: How to Redirect non-www to www for specified doman?
ewwink
Group: Member
Post Group: Newbie
Posts: 23
Status:
Quote From : valley December 23, 2013, 5:29 am

I got the code there, OK I will try to edit /etc/nginx/sites-available/www.example.com.vhost <- is it right location ?
IP: --   

Nginx: How to Redirect non-www to www for specified doman?
ewwink
Group: Member
Post Group: Newbie
Posts: 23
Status:
Found it, I have to edit
/usr/local/apps/nginx/etc/conf.d/webuzoVH.conf
IP: --   

Nginx: How to Redirect non-www to www for specified doman?
valley
Group: Webuzo Team
Post Group: Super Member
Posts: 1644
Status:
Quote From : ewwink December 23, 2013, 5:47 am
Found it, I have to edit
/usr/local/apps/nginx/etc/conf.d/webuzoVH.conf


The file webuzoVH.conf is re-built every time you add/delete a domain.
Put your configuration changes in the file /usr/local/apps/nginx/etc/conf.d/common

Hope it helps \m/


-----------------------
Webuzo : Single User Control Panel
Join Webuzo :
Facebook
Twitter

IP: --   

« Previous    Next »

Threaded Mode | Print  



Jump To :


Users viewing this topic
1 guests, 0 users.


All times are GMT. The time now is May 24, 2024, 5:54 am.

  Powered By AEF 1.0.8 © 2007-2008 Electron Inc.Queries: 10  |  Page Created In:0.039