Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Hide extension and take PATH_INFO ?

$
0
0
With Apache, this address:

http://www.example.com/abc/def/ghi/jkl/mno

will work if any of these files exist:

/abc.php
/abc/def.php
/abc/def/ghi.php
/abc/def/ghi/jkl.php
/abc/def/ghi/jkl/mno.php

without even turning on mod_rewrite. It takes just these two lines:

Options MultiViews
AcceptPathInfo On

(Actually, for .php files and other scripts, you don't even need AcceptPathInfo. It's on by default). The remaining extra path will become $_SERVER['PATH_INFO'].

I can't figure out how to do it in nginx. It seems to handle only simple rewrites.

But this is very useful for a busy team that handles a few dozen applications on a corporate intranet. We can drop dynamic pages in among various static files, without having to add Location blocks to the central config files and restart the web server.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>