Nginx remove a get parameter from URL - nginx

In NGINX how can I redirect any URL that contains ?SID=(insert long string of numbers/letters)
To a clean URL that is exactly the same but without this query? Other get query must remain untouched.
Also I only want to perform this redirect if the URL also does not contain '/sgps/'
Any takers?

Related

Nginx Change Request from GET to POST with one specific URL

I have a site all URL use method get, but one of them use post, so I want to resolve this in nginx
But the specific URL say me file not found

Need to configure nginx to preserve url parameters after a redirect

So I need a little bit help with nginx configurations. The goal I'm trying to achieve is keeping the url parameters after a redirect.
For example when I access (the old url) www.old.com/serivce/documentation7777/asdad2 I want to be redirected to the new url preserving the url parameters www.new.com/new-serivce/documentation7777/asdad2
Currently there is location block
location /servce/?(.*) {
return 301 https://www.new.com/new-service/$1$is_args$args;
}
When I try to access the old url just www.old.com, I get redirected to https://www.new.com but when I add url parameters to the old url i get a 404.
Help needed please.

Parse url to get a string in Nginx

I have a web server sitting behind Nginx. If there is an error, then I want to fetch some information from the url and pass it on to a static file as parameters. I have configured Nginx to fetch the url parameters from the url using $arg_param_name. However, I also need to fetch a String from the url path itself. So if the url is as below:
www.website.com/path1/path2?arg1=val&arg2=someval
Now, how can I parse this url to fetch the last path (path2 in this case)? My location directive is as below:
location ~*/path1/{
...
}
The url need not always have the same number of paths. It can also have 3 paths. So I can't use $1, $2 etc. I need to fetch the last path, i.e the path which is immediately followed by the url parameters (the ? symbol).

What exactly is URL rewriting?

Which of them is correct definition of URL rewriting?
Shortening of URL for end-user as elaborated here
Appending extra arguments to URL sent to server for session management
I am confused over which one was invented first, and which one should be correct definition of URL re-write?
URL rewriting is simply what its name implies: rewriting/modification of URLs.
This can be used for shortening URLs, and it can be used for appending query parameters, but it’s not restricted to these two use cases.
To make the URL more readable
Example www.abc.com?id=1 rewrite it to www.abc.com/1

How to remove query string or how to maintain constant URL using URL rewrite

How to maintain constant URL?
For example:
http:// test23232 /temp/temp.aspx?a=1&b=1
a,b,query string parameter name get differ dynamically page to page(want to use those parameter but not dispaly for users)
While redirecting ,whatever the value present after ? should be removed and final URL displayed to users:
http:// test23232 /temp/temp.aspx or http:// test23232 /temp
Or any constant url post login mentioned throughout entire application.
I can acheive this by iframe, but how can I do by doing web.config through rule or global ascx.
or
whatever page redirect
http : //localhost /test/security / login.aspx
http : //localhost /test/security / main.aspx
http : //localhost /test/security / details.aspx
I want to show to browser as
http :// localhost / reap/ security /
Is it possible?
Use Session to store the values of a and b and keep the url simple.
You can send the necessary parameter using post method instead of get method.
More secure way of passing them is to store them into session variable.
that might make it more "secure" since then the client cannot change the variables by editing the source.
It will depends on how you really want to do.
The session parameters will keep on changing dynamically for every request.We can go for cookies.
Yet this link might be useful for url rewriting

Resources