Redirect WWW to non-WWW witn NginX & PHP-fpm
Redirect WWW to non-WWW witn NginX & PHP-fpm
Hey everyone,
Am facing a problem with having accessible www and non-www in domain.
The problem is that the domain to be shown it should be the non-www but both are accessible. This is what i added to the template am using but it's not working.
Is there anyone who has the solution to this tweak?
Thank you
Am facing a problem with having accessible www and non-www in domain.
The problem is that the domain to be shown it should be the non-www but both are accessible. This is what i added to the template am using but it's not working.
Is there anyone who has the solution to this tweak?
Code: Select all
server {
server_name "~^www\.(.*)$" ;
return 301 $scheme://$1$request_uri ;
}
server {
listen %ip%:%web_ssl_port%;
server_name %domain_idn% %alias_idn%;
root %sdocroot%;
index index.php index.html index.htm;
access_log /var/log/nginx/domains/%domain%.log combined;
access_log /var/log/nginx/domains/%domain%.bytes bytes;
error_log /var/log/nginx/domains/%domain%.error.log error;
Thank you