I want to redirect my domain example.com to www.example.com
My /etc/nginx/sites-available/example.com configuration is
server {
listen 80;
listen [::]:80;
root /var/www/example.com/html;
index index.php index.html index.htm;
server_name example.com www.example.com;
location / {
try_files $uri $uri/ /index.php?q=$request_uri;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
What changes should I do in this code?
I have added this line : try_files $uri $uri/ /index.php?q=$request_uri;
for wordpress permanent link correction.