I've been trying for a few days to get apache-style multiviews working with path_info with no luck. I'm using nginx/1.2.1 and php5-fpm 2.4.0. My goal is to be able to visit example.com/product/48/my-product-name
where product
translates to product.php
and everything proceeding interpreted as the path_info.
I've devised a regex to split the URI into product
and /48/my-product-name
which seems to work on paper but doesn't work in my config:
^(.+?)(\/.*)$
I've used this with fastcgi_split_path_info while defining fastcgi_param SCRIPT_FILENAME etc... and many more combinations.
EDIT: I just realised this regex wont work with with a url such as: example.com/dir/script/path/info
it wont be translated to dir/script.php
, and /path/info
, but /dir.php
, and /script/path/info
. I'm starting to wonder if this is even possible to overcome?
I'm new to nginx and want to try it out since it apparently is much faster and less resource-hungry than Apache, but I can't see why this would be such a hard thing to achieve. Any help is greatly appreciated. Thanks.