Complex url rewriting

Aleksandar Lazic al-nginx at
Mon Nov 23 20:50:33 UTC 2015


Am 23-11-2015 18:48, schrieb lmauldinpe15:
> I have a single Nginx installation and I am using PHP-FPM to serve 
> multiple
> PHP applications in sub directories.  Example:
> /var/www/  (this is 'root')
> /var/www/a/foo/index.php
> /var/www/a/bar/index.php
> /var/www/b/bar/index.php
> I want to setup url rewriting so that any request to
> http://xxx/a/foo/index.php/users/login gets redirected to
> http://xxx/a/foo/index.php and similarly
> http://xxx/a/bar/index.php/users/login gets redirected to
> http://xxx/a/bar/index.php
> I may have a large number of applications in the sub directories so I 
> don't
> want to setup individual location blocks for each application.  Can I
> accomplish this with a global rewrite rule?  Please let me know if you 
> need
> more information.

How about to use the map module and some lines of scripting

and use the right command for the location block.

Pick a variable of your choice ;-)
I would suggest

but that's my opinion.

Do you a favor and use the debug log for debugging ;-)

BR Aleks

More information about the nginx mailing list