Welcome! Log In Create A New Profile

Advanced

Trailing slash being removed from document root

January 04, 2012 05:30PM
Hi all. We're considering switching from lighttpd to nginx in my company and so far everything looks good except for one thing I can't seem to figure out.

When getting the document root in PHP from nginx using this:

$_SERVER['DOCUMENT_ROOT']."../".$ZONE."/".$LOCALE...etc......

nginx will always return the path WITHOUT the trailing slash. I have the document root configured like this:

root /home/web/www.site.com/html/; # note the trailing slash

We have way too much code in php that gets the document root without adding a trailing slash after $_SERVER['DOCUMENT_ROOT'] because lighttpd and apache before that always had preserved the trailing slash.

How can I configure nginx to keep the slash?

Thanks!
Subject Author Posted

Trailing slash being removed from document root

freejack January 04, 2012 05:30PM

Re: Trailing slash being removed from document root

Francis Daly January 04, 2012 05:58PM

Re: Trailing slash being removed from document root

freejack January 04, 2012 06:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 70
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready