Welcome! Log In Create A New Profile

Advanced

Re: Complex url rewriting

Aleksandar Lazic
November 23, 2015 03:52PM
Hi.

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

http://nginx.org/en/docs/http/ngx_http_map_module.html

and use the right command for the location block.

http://nginx.org/en/docs/http/ngx_http_core_module.html#alias
http://nginx.org/en/docs/http/ngx_http_core_module.html#root

Pick a variable of your choice ;-)

http://nginx.org/en/docs/varindex.html
I would suggest

http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri

but that's my opinion.

Do you a favor and use the debug log for debugging ;-)
http://nginx.org/en/docs/debugging_log.html

BR Aleks

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Complex url rewriting

lmauldinpe15 November 23, 2015 12:48PM

Re: Complex url rewriting

lmauldinpe15 November 23, 2015 01:19PM

Re: Complex url rewriting

B.R. November 23, 2015 02:46PM

Re: Complex url rewriting

lmauldinpe15 November 23, 2015 03:34PM

Re: Complex url rewriting

Aleksandar Lazic November 23, 2015 03:52PM

Re: Complex url rewriting

lmauldinpe15 November 24, 2015 05:21PM

Re: Complex url rewriting

lmauldinpe15 November 24, 2015 05:53PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 196
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready