Targeting homepage (not sub pages/dirs/)

Francis Daly francis at daoine.org
Fri Jan 17 18:30:24 UTC 2014


On Fri, Jan 17, 2014 at 06:40:37PM +0100, Lorenzo Raffio wrote:

Hi there,

> What should I add to this directive to target also the home page (root of
> the website, e.g. website.com)?

I'd suggest

  location = / {}

as being simplest.

But if you want it to be part of the already-present regex, then you
want to match either "exactly /" or "starts with /?".

"exactly" is "start of string, /, end of string".

"starts with" is "start of string, /, ?".

Check your regex manual for which bits need to be escaped and which bits
mean "start" and "end".

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org



More information about the nginx mailing list