rewrite assistance
Igor Sysoev
igor at sysoev.ru
Wed Nov 24 14:25:45 MSK 2010
On Tue, Nov 23, 2010 at 11:42:38PM -0500, daveyfx wrote:
> Francis Daly Wrote:
> -------------------------------------------------------
>
> > Assuming that this sentence describes your wish:
> >
> > location = /preview.php {
> > rewrite ^ /? permanent;
> > }
> >
> > (untested!) should probably Just Work.
> >
> > If you *do* want to vary based on the query string
> > (?-bit), the manual
> > has an example.
> >
> > Good luck,
> >
> > f
> > --
> > Francis Daly francis at daoine.org
>
> Francis,
>
> Spot on. That seems to have done the trick. Out of my own desire to
> learn, is there a way to do the same thing without using the location
> directive, and just merely using a rewrite statement?
You can place the rewrite on server level, but it's better to use
the location, because otherwise nginx will run regex "^/preview\.php$" for
every request. Testing "location = /preview.php" is faster.
--
Igor Sysoev
http://sysoev.ru/en/
More information about the nginx
mailing list