Welcome! Log In Create A New Profile

Advanced

Re: Problem with return 302 redirection, with Nginx 1.3.11 + Drupal 7

Francis Daly
January 23, 2013 07:04AM
On Wed, Jan 23, 2013 at 11:46:23AM +0000, Mark Alan wrote:

Hi there,

> location ~* ^/(\?q=)?(?:user|admin|contact$) {
> return 302 https://$host$request_uri;
> }

That probably won't match the request that you want it to match.

> What should I do to get http://example.com/?q=user redirected to
> https://example.com/user or, if that is not possible, to
> https://example.com/?q=user ?

The request http://example.com/?q=user has location = /, and $query_string
= q=user, and $arg_q = user.

So you should use some combination of those variables within

location = / {}

to do the redirection.

Use $arg_q if you don't care about any other parts of the query string. If
you have many things to compare, creating a "map" is probably worthwhile.

And you'll also want to consider what to do in that location if $arg_q
is not one that you want to redirect -- possibly just letting it fall
through to the "index" value will do.

f
--
Francis Daly francis@daoine.org

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

Problem with return 302 redirection, with Nginx 1.3.11 + Drupal 7

Mark Alan January 23, 2013 06:48AM

Re: Problem with return 302 redirection, with Nginx 1.3.11 + Drupal 7

Francis Daly January 23, 2013 07:04AM

Re: Problem with return 302 redirection, with Nginx 1.3.11 + Drupal 7

António P. P. Almeida January 23, 2013 08:14AM

SOLVED Re: Problem with return 302 redirection, with Nginx 1.3.11 + Drupal 7

Mark Alan January 23, 2013 03:32PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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