Rewrite https to http expect one location

Hello,
I have a config like:

server {

do not rewrite this

location /mailadmin/(.*..php)$ {
# some stuff
}

location / {
# some other stuff

  rewrite ^ http://$server_name$request_uri? permanent;

}

location ~ .php$ {
# php stuff;
}
}

URLs like
https://example.com/mailadmin/test.php?ps=301A1123344556E925803435&framework=
are partly rewrite.

Regards,
Basti

On Mon, Feb 24, 2014 at 04:10:24PM +0100, basti wrote:

Hi there,

do not rewrite this

location /mailadmin/(.*..php)$ {

You probably will have no requests that will match this prefix location.

location / {
rewrite ^ http://$server_name$request_uri? permanent;

Many requests will match this location, and be redirected to a http url.

location ~ .php$ {

Some requests will match this location.

URLs like
https://example.com/mailadmin/test.php?ps=301A1123344556E925803435&framework=
are partly rewrite.

I would expect that request to match the third location.

What response do you get for it? What response do you want for it?

f

Francis D. [email protected]

There is still a rewrite problem with my config:

server {

root $root_directory;

index index.php index.html index.htm;
fastcgi_index index.php;

location ~ /mailadmin/(.*..php)$ {
root /path/to/root/;

index index.php;
}

location / {
return 301 http://$server_name$request_uri;
}
}

I want all != mailadmin is rewrite to http.

URLs like
https://example.com/mailadmin/test.php?ps=301A1123344556E925803435&framework=
https://example.com/mailadmin/share/themes/default/tabmain/first_on.gif
I don’t want to rewrite.

But https://www.tank-app.de/mailadmin/ is also rewrite, I dont know why.