Adult Script Pro Community Forums

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.

#1 2015-06-18 07:34:26

DuttyRock
Member
Registered: 2011-11-05
Posts: 740

Non-WWW to WWW

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

#2 2015-06-18 09:22:15

thiva7
Member
Registered: 2011-04-30
Posts: 1,022

Re: Non-WWW to WWW

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

#3 2015-06-18 18:45:37

DuttyRock
Member
Registered: 2011-11-05
Posts: 740

Re: Non-WWW to WWW

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

Board footer

Powered by FluxBB