Welcome! Log In Create A New Profile

Advanced

Re: rewrite assistance

Francis Daly
November 23, 2010 07:32PM
On Tue, Nov 23, 2010 at 04:41:04PM -0500, daveyfx wrote:

Hi there,

> I'm trying to add in a rewrite rule that will take this string and just
> do a redirect to /
> /preview.php?controllerName=channel&id=2

http://wiki.nginx.org/HttpRewriteModule is worth reading.

> Since the query string can vary, how would I craft my rewrite
> appropriately to do this? I've tried a few variations of the following,
> but all it does is remove the "preview.php" portion of the string,
> leaving the "?controllerName=channel&id=2"
> rewrite ^/preview.php(.*) / permanent;

rewrite appends args unless the last character of the replacement is "?".

> Essentially I just watch to match against "preview.php" and redirect to
> the index portion of the site.

This description is not the same at the earlier ones.

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@daoine.org

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

rewrite assistance

daveyfx November 23, 2010 04:41PM

Re: rewrite assistance

António P. P. Almeida November 23, 2010 04:58PM

Re: rewrite assistance

daveyfx November 23, 2010 07:22PM

Re: rewrite assistance

Francis Daly November 23, 2010 07:32PM

Re: rewrite assistance

daveyfx November 23, 2010 11:42PM

Re: rewrite assistance

Francis Daly November 24, 2010 05:48AM

Re: rewrite assistance

Igor Sysoev November 24, 2010 06:30AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 88
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready