rewrite to www EXCEPT for one directory

eddy at SDF.ORG eddy at SDF.ORG
Thu Sep 6 20:32:48 UTC 2012


> On Thursday 06 September 2012 22:22:07 Ian Evans wrote:
>   server {
>       listen 80;
>       server_name example.com;
>       location / {
>           return 301 http://www.example.com$request_uri;
>       }
>       location /blogs {
>           # configuration for WordPress
>       }
>   }
>  wbr, Valentin V. Bartenev

I suggest to use $scheme like in:

rewrite ^(.*) $scheme://www.example.org/$1 permanent;

to keep the https connection (if a client wants to use it). otherwise your
server drops the https connection and the client will connect over http.
i.e.: if you want to use /wp-admin only over https with
"define('FORCE_SSL_ADMIN', true);" in /wp-config.php, it will safe you a
lot of annoying behavior...

~ed







More information about the nginx mailing list