Welcome! Log In Create A New Profile

Advanced

Redirect to https for certain urls

Posted by kaukopartio1 
Redirect to https for certain urls
July 11, 2011 08:09AM
Hi,

I have worked with Nginx only short time and I'm led to in deep trouble with one configuration task.

Basically I'd like to redirect all other requests than root document request to https but I can't find a way to do it.

Currently I have this in nginx.conf

rewrite ^(.*) https://www.certainsite.com$1 permanent;

it redirects every plain http request to https by responding http 301

HTTP/1.1 301 Moved Permanently

But how to exclude only the root from this rule.


thanks for any response !

kp
Re: Redirect to https for certain urls
July 12, 2011 09:34AM
#rewrite ^(/.+)$ https://www.somesite.com$1 permanent;
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 78
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready