I am new to nginx, I have rewrite directives to redirect hostnames to other hostnames. I want to preserve the URI in the request to the redirect so for example http://www.johntate.org/blog goes to http://johntate.org/blog and so on.
At the moment I just have this...
server {
listen 80;
server_name www.johntate.org;
rewrite / http://johntate.org/;
}
I want something more complicated that preserves the request and forwards it.
Adapted from the example on https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#server-name-if :
(
$scheme
expands tohttp
orhttps
depending on connection type)Have a look at the documentation at http://wiki.nginx.org/HttpRewriteModule before asking further questions on this.