jeudi 26 mars 2015

Using www along with non-www for main domain in multisite installation


I have a multisite installation that runs on Nginx.


In my site's configuration file, I have set the server block as:



server{
listen 80 default_server;
server_name example.com *.example.com;
server_name_in_redirect off;

access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log;

root /var/www/example.com/htdocs;
index index.php;

if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) $2 last;
rewrite ^(/[^/]+)?(/.*\.php) $2 last;
}

location / {
try_files $uri $uri/ /index.php?$args;
}
}


Right now, whenever I enter www.example.com in the browser, I get redirected to example.com.


However, I want example.com to redirect to www.example.com.


I also plan to use HTTPS with www.example.com


What else do I need to add to my configuration file to make this happen?





Aucun commentaire:

Enregistrer un commentaire