The forum is here for legacy reasons. No new posts will be created. User registration is disabled! If you have any questions, please email us or check https://www.adultscriptpro.com for more details!
You are not logged in.
Pages: 1
How can i redirect non www (mysite.com) to WWW (www.mysite.com) in nginx, i don't think .htaccess codes work for nginx because i tired them.
Don't know if anyone else notice but with the new script you can't log into your account from frontend unless it have www. infront of your web url.
Offline
Try this
Edit your virtualhost file and replace yourdomain.com with www.yourdomain.com and add this at the top:
server {
listen 80;
server_name yourdomain.com;
return 301 http://www.yourdomain.com$request_uri;
}
sudo service nginx restart
Last edited by thiva7 (2015-06-18 09:25:52)
Offline
Thanks bro that works. For others who want to do this with nginx you also have to have anther server { under what Thiva7 posted like this:
server {
listen 80;
server_name www.mysite.com;
#limit_zone one $binary_remote_addr 10m;
access_log off;
error_log /var/log/nginx/mysite.com-error.log notice;
root /xxx/xxx/xxx/;
index index.php;
}
Offline
Pages: 1