NginX URL rewrite regex (get rid of special characters ://)

27 Views Asked by At

I'm trying to figure out how to use the NginX rewrite so I can load the page

https://example.com/page.php?url=https://www.domain2.com/1-2-3-4-5

using this URL

https://example.com/page/www.domain2.com/1-2-3-4-5

So what I'm trying to do is basically get rid of the .php?url=https:/

Can anyone help please?

I've tried to follow the documentation but I suppose I'm too dumb for it.

My rewrite rule looks like this:

location /page.php {
rewrite ^/page/(.*)$ /page.php?url=https://$1? last;
}

Using this rule, the page loads the index instead.

0

There are 0 best solutions below