Welcome! Log In Create A New Profile

Advanced

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson
November 26, 2013 11:38AM
On 11/19/2013 12:38 PM, Francis Daly wrote:
> On Tue, Nov 19, 2013 at 10:36:53AM -0500, Ben Johnson wrote:
>
> Hi there,
>
>> This works as expected, with one major exception: "clean-URL" rewriting
>> does not work. In other words, the homepage (/stage/) loads correctly,
>> but all sub-pages return a 404. As soon as I attempt to add "rewrite"
>> directives for clean-URLs, the server either returns a 500 (redirect
>> cycle) or "Primary script unknown".
>
> Can you give an example of a "clean-URL" that matches the location that
> you use, and that does not do what you want it to do?
>
> Note that your rewrite only happens for urls that end ".php".
>
> f
>

Thanks for your help, Francis!

Certainly: an example URL is /stage/my-account/ . Ultimately, I would
like for this URL to be rewritten to
/stage/index.php?q=/stage/my-account/ (the file "index.php" exists on
the filesystem at /var/www/example.com/private/stage/web/index.php).

Regarding the rewrite happening only for URLs that end in .php, that had
occurred to me, but if I try to move the rewrite "up one level", into
the block "location ^~ /stage/ {", nginx complains upon requesting the
URL /stage/ that '"alias" cannot be used in location "/stage/" where URI
was rewritten'.

Fundamentally, is the problem here that I need to be modifying the
"alias" directive dynamically (with regular expressions and capture
groups), instead of trying to achieve the same with the "rewrite" directive?

Thanks again for your time,

-Ben

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

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson November 26, 2013 11:38AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Francis Daly November 26, 2013 11:38AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson November 26, 2013 11:38AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson November 26, 2013 11:39AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Francis Daly November 26, 2013 11:39AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson November 26, 2013 11:39AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson November 26, 2013 11:39AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Francis Daly November 26, 2013 11:39AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Francis Daly November 26, 2013 11:38AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson November 26, 2013 11:39AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Ben Johnson November 26, 2013 11:38AM

Re: Clean-URL rewrite rule with nested "location" and alias directive

Francis Daly November 26, 2013 11:39AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 173
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